Class: Shell::DoppelGangerClient
- Inherits:
-
Chef::Client
- Object
- Chef::Client
- Shell::DoppelGangerClient
- Defined in:
- lib/chef/shell/shell_session.rb
Instance Attribute Summary collapse
-
#node_name ⇒ Object
readonly
Returns the value of attribute node_name.
Attributes inherited from Chef::Client
#events, #json_attribs, #node, #ohai, #rest, #run_status, #runner
Instance Method Summary collapse
-
#build_node ⇒ Object
DoppelGanger implementation of build_node.
-
#initialize(node_name) ⇒ DoppelGangerClient
constructor
A new instance of DoppelGangerClient.
- #register ⇒ Object
-
#run_ohai ⇒ Object
Run the very smallest amount of ohai we can get away with and still hope to have things work.
Methods inherited from Chef::Client
clear_notifications, #configure_formatters, #converge, #default_formatter, #do_windows_admin_check, #expand_run_list, #formatters_for_run, #load_node, #run, #run_completed_successfully, run_completed_successfully_notifications, #run_failed, run_failed_notifications, run_start_notifications, #run_started, #save_updated_node, #setup_run_context, #sync_cookbooks, when_run_completes_successfully, when_run_fails, when_run_starts
Methods included from Chef::Mixin::PathSanity
Constructor Details
#initialize(node_name) ⇒ DoppelGangerClient
Returns a new instance of DoppelGangerClient.
230 231 232 233 |
# File 'lib/chef/shell/shell_session.rb', line 230 def initialize(node_name) @node_name = node_name @ohai = Ohai::System.new end |
Instance Attribute Details
#node_name ⇒ Object (readonly)
Returns the value of attribute node_name.
228 229 230 |
# File 'lib/chef/shell/shell_session.rb', line 228 def node_name @node_name end |
Instance Method Details
#build_node ⇒ Object
DoppelGanger implementation of build_node. preserves as many of the node’s attributes, and does not save updates to the server
243 244 245 246 247 248 249 250 251 252 253 |
# File 'lib/chef/shell/shell_session.rb', line 243 def build_node Chef::Log.debug("Building node object for #{@node_name}") @node = Chef::Node.find_or_create(node_name) ohai_data = @ohai.data.merge(@node.automatic_attrs) @node.consume_external_attrs(ohai_data,nil) @run_list_expansion = @node.('server') @expanded_run_list_with_versions = @run_list_expansion.recipes.with_version_constraints_strings Chef::Log.info("Run List is [#{@node.run_list}]") Chef::Log.info("Run List expands to [#{@expanded_run_list_with_versions.join(', ')}]") @node end |
#register ⇒ Object
255 256 257 |
# File 'lib/chef/shell/shell_session.rb', line 255 def register @rest = Chef::REST.new(Chef::Config[:chef_server_url], Chef::Config[:node_name], Chef::Config[:client_key]) end |
#run_ohai ⇒ Object
Run the very smallest amount of ohai we can get away with and still hope to have things work. Otherwise we’re not very good doppelgangers
237 238 239 |
# File 'lib/chef/shell/shell_session.rb', line 237 def run_ohai @ohai.require_plugin('os') end |