Class: Shell::DoppelGangerSession
- Inherits:
-
ClientSession
- Object
- ShellSession
- ClientSession
- Shell::DoppelGangerSession
- Defined in:
- lib/chef/shell/shell_session.rb
Instance Attribute Summary
Attributes inherited from ShellSession
#client, #compile, #json_configuration, #node, #node_attributes, #recipe, #run_context
Instance Method Summary collapse
Methods inherited from ClientSession
#definitions, #rebuild_context
Methods inherited from ShellSession
#cookbook_loader, #definitions, #initialize, inspect, #node_built?, #rebuild_context, #reset!, #resource_collection, session_type
Constructor Details
This class inherits a constructor from Shell::ShellSession
Instance Method Details
#assume_identity(node_name) ⇒ Object
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 |
# File 'lib/chef/shell/shell_session.rb', line 284 def assume_identity(node_name) Chef::Config[:doppelganger] = @node_name = node_name reset! rescue Exception => e puts "#{e.class.name}: #{e.}" puts Array(e.backtrace).join("\n") puts puts "* " * 40 puts "failed to assume the identity of node '#{node_name}', resetting" puts "* " * 40 puts Chef::Config[:doppelganger] = false @node_built = false Shell.session end |
#rebuild_node ⇒ Object
300 301 302 303 304 305 306 307 308 309 |
# File 'lib/chef/shell/shell_session.rb', line 300 def rebuild_node # Make sure the client knows this is not chef solo Chef::Config[:solo] = false @client = DoppelGangerClient.new(@node_name) @client.run_ohai @client.register @client.load_node @client.build_node @client.sync_cookbooks end |
#save_node ⇒ Object
280 281 282 |
# File 'lib/chef/shell/shell_session.rb', line 280 def save_node puts "A doppelganger should think twice before saving the node" end |