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