Class: Shell::ShellSession
- Includes:
- Singleton
- Defined in:
- lib/chef/shell/shell_session.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#compile ⇒ Object
Returns the value of attribute compile.
-
#node ⇒ Object
Returns the value of attribute node.
-
#node_attributes ⇒ Object
Returns the value of attribute node_attributes.
-
#recipe ⇒ Object
Returns the value of attribute recipe.
-
#run_context ⇒ Object
Returns the value of attribute run_context.
Class Method Summary collapse
Instance Method Summary collapse
- #cookbook_loader ⇒ Object
- #definitions ⇒ Object
-
#initialize ⇒ ShellSession
constructor
A new instance of ShellSession.
- #node_built? ⇒ Boolean
- #rebuild_context ⇒ Object
- #reset! ⇒ Object
- #resource_collection ⇒ Object
- #save_node ⇒ Object
Constructor Details
permalink #initialize ⇒ ShellSession
Returns a new instance of ShellSession.
43 44 45 46 47 |
# File 'lib/chef/shell/shell_session.rb', line 43 def initialize @node_built = false formatter = Chef::Formatters.new(Chef::Config.formatter, STDOUT, STDERR) @events = Chef::EventDispatch::Dispatcher.new(formatter) end |
Instance Attribute Details
permalink #client ⇒ Object (readonly)
Returns the value of attribute client.
42 43 44 |
# File 'lib/chef/shell/shell_session.rb', line 42 def client @client end |
permalink #compile ⇒ Object
Returns the value of attribute compile.
41 42 43 |
# File 'lib/chef/shell/shell_session.rb', line 41 def compile @compile end |
permalink #node ⇒ Object
Returns the value of attribute node.
41 42 43 |
# File 'lib/chef/shell/shell_session.rb', line 41 def node @node end |
permalink #node_attributes ⇒ Object
Returns the value of attribute node_attributes.
42 43 44 |
# File 'lib/chef/shell/shell_session.rb', line 42 def node_attributes @node_attributes end |
Class Method Details
permalink .inspect ⇒ Object
[View source]
129 130 131 |
# File 'lib/chef/shell/shell_session.rb', line 129 def @node.inspect "<Chef::Node:0x#{self.object_id.to_s(16)} @name=\"#{self.name}\">" end |
permalink .session_type(type = nil) ⇒ Object
[View source]
36 37 38 39 |
# File 'lib/chef/shell/shell_session.rb', line 36 def self.session_type(type=nil) @session_type = type if type @session_type end |
Instance Method Details
permalink #cookbook_loader ⇒ Object
[View source]
84 85 86 |
# File 'lib/chef/shell/shell_session.rb', line 84 def cookbook_loader nil end |
permalink #definitions ⇒ Object
[View source]
80 81 82 |
# File 'lib/chef/shell/shell_session.rb', line 80 def definitions nil end |
permalink #node_built? ⇒ Boolean
49 50 51 |
# File 'lib/chef/shell/shell_session.rb', line 49 def node_built? !!@node_built end |
permalink #rebuild_context ⇒ Object
[View source]
92 93 94 |
# File 'lib/chef/shell/shell_session.rb', line 92 def rebuild_context raise "Not Implemented! :rebuild_collection should be implemented by subclasses" end |
permalink #reset! ⇒ Object
[View source]
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/chef/shell/shell_session.rb', line 53 def reset! loading do rebuild_node @node = client.node shorten_node_inspect Shell::Extensions.extend_context_node(@node) rebuild_context node.consume_attributes(node_attributes) if node_attributes @recipe = Chef::Recipe.new(nil, nil, run_context) Shell::Extensions.extend_context_recipe(@recipe) @node_built = true end end |
permalink #resource_collection ⇒ Object
[View source]
72 73 74 |
# File 'lib/chef/shell/shell_session.rb', line 72 def resource_collection run_context.resource_collection end |
permalink #save_node ⇒ Object
[View source]
88 89 90 |
# File 'lib/chef/shell/shell_session.rb', line 88 def save_node raise "Not Supported! #{self.class.name} doesn't support #save_node, maybe you need to run chef-shell in client mode?" end |