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.
25
26
27
|
# File 'lib/chef/shef/shef_session.rb', line 25
def initialize
@node_built = false
end
|
Instance Attribute Details
Returns the value of attribute client.
23
24
25
|
# File 'lib/chef/shef/shef_session.rb', line 23
def client
@client
end
|
Returns the value of attribute compile.
22
23
24
|
# File 'lib/chef/shef/shef_session.rb', line 22
def compile
@compile
end
|
Returns the value of attribute node.
22
23
24
|
# File 'lib/chef/shef/shef_session.rb', line 22
def node
@node
end
|
#node_attributes ⇒ Object
Returns the value of attribute node_attributes.
23
24
25
|
# File 'lib/chef/shef/shef_session.rb', line 23
def node_attributes
@node_attributes
end
|
Returns the value of attribute recipe.
22
23
24
|
# File 'lib/chef/shef/shef_session.rb', line 22
def recipe
@recipe
end
|
Class Method Details
102
103
104
|
# File 'lib/chef/shef/shef_session.rb', line 102
def @node.inspect
"<Chef::Node:0x#{self.object_id.to_s(16)} @name=\"#{self.name}\">"
end
|
Instance Method Details
#collection ⇒ Object
49
50
51
|
# File 'lib/chef/shef/shef_session.rb', line 49
def collection
@collection || rebuild_collection
end
|
#cookbook_loader ⇒ Object
57
58
59
|
# File 'lib/chef/shef/shef_session.rb', line 57
def cookbook_loader
nil
end
|
#definitions ⇒ Object
53
54
55
|
# File 'lib/chef/shef/shef_session.rb', line 53
def definitions
nil
end
|
#node_built? ⇒ Boolean
29
30
31
|
# File 'lib/chef/shef/shef_session.rb', line 29
def node_built?
!!@node_built
end
|
#rebuild_collection ⇒ Object
65
66
67
|
# File 'lib/chef/shef/shef_session.rb', line 65
def rebuild_collection
raise "Not Implemented! :rebuild_collection should be implemented by subclasses"
end
|
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/chef/shef/shef_session.rb', line 33
def reset!
loading do
rebuild_node
@node = client.node
node.consume_attributes(node_attributes) if node_attributes
shorten_node_inspect
@recipe = Chef::Recipe.new(nil, nil, @node)
@node_built = true
end
end
|
#save_node ⇒ Object
61
62
63
|
# File 'lib/chef/shef/shef_session.rb', line 61
def save_node
raise "Not Supported! #{self.class.name} doesn't support #save_node, maybe you need to run shef in client mode?"
end
|