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

- (Hash) automatic

Returns the automatic attribute

Returns:

  • (Hash)

    the automatic attribute



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

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

- (String) chef_type

Returns the chef_type attribute

Returns:

  • (String)

    the chef_type attribute



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

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

- (Hash) default

Returns the default attribute

Returns:

  • (Hash)

    the default attribute



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

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

- (String) json_class

Returns the json_class attribute

Returns:

  • (String)

    the json_class attribute



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

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

- (String) name

Returns the name attribute

Returns:

  • (String)

    the name attribute



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

attribute :name, String

- (Hash) normal

Returns the normal attribute

Returns:

  • (Hash)

    the normal attribute



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

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

- (Hash) override

Returns the override attribute

Returns:

  • (Hash)

    the override attribute



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

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

- (Array) run_list

Returns the run_list attribute

Returns:

  • (Array)

    the run_list attribute



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

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

Class Method Details

+ (Object) get(name)



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

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

Instance Method Details

- (Boolean) new_record?

Check if the node exists on the Chef server

Returns:

  • (Boolean)


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