Class: Spice::Node

Inherits:
Object
  • Object
show all
Extended by:
Persistence
Includes:
Persistence, Toy::Store
Defined in:
lib/spice/node.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Persistence

all, connection, do_delete, do_post, do_put, endpoint, get, included

Instance Attribute Details

#automaticHash



20
# File 'lib/spice/node.rb', line 20

attribute :automatic, Hash, :default => {}

#chef_typeString



15
# File 'lib/spice/node.rb', line 15

attribute :chef_type, String, :default => "node"

#defaultHash



19
# File 'lib/spice/node.rb', line 19

attribute :default, Hash, :default => {}

#json_classString



16
# File 'lib/spice/node.rb', line 16

attribute :json_class, String, :default => "Chef::Node"

#nameString



14
# File 'lib/spice/node.rb', line 14

attribute :name, String

#normalHash



17
# File 'lib/spice/node.rb', line 17

attribute :normal, Hash, :default => {}

#overrideHash



18
# File 'lib/spice/node.rb', line 18

attribute :override, Hash, :default => {}

#run_listArray



21
# File 'lib/spice/node.rb', line 21

attribute :run_list, Array, :default => []

Class Method Details

.get(name) ⇒ Object



25
26
27
# File 'lib/spice/node.rb', line 25

def self.get(name)
  connection.node(name)
end

Instance Method Details

#new_record?Boolean

Check if the node exists on the Chef server



30
31
32
33
34
35
36
37
# File 'lib/spice/node.rb', line 30

def new_record?
  begin
    connection.get("/nodes/#{name}")
    return false
  rescue Spice::Error::NotFound
    return true
  end
end