Class: Ridley::Node

Inherits:
Object
  • Object
show all
Includes:
Resource
Defined in:
lib/ridley/resources/node.rb

Overview

Author:

Instance Method Summary collapse

Methods included from Resource

#==, #attribute, #attribute=, #attribute?, #attributes, #attributes=, #chef_id, #eql?, #from_hash, #from_json, #initialize, #save, #to_hash, #to_json, #to_s

Instance Method Details

#automatic=(hash) ⇒ Object

Parameters:

  • hash (Hash)


22
23
24
# File 'lib/ridley/resources/node.rb', line 22

def automatic=(hash)
  super(HashWithIndifferentAccess.new(hash))
end

#default=(hash) ⇒ Object

Parameters:

  • hash (Hash)


32
33
34
# File 'lib/ridley/resources/node.rb', line 32

def default=(hash)
  super(HashWithIndifferentAccess.new(hash))
end

#normal=(hash) ⇒ Object

Parameters:

  • hash (Hash)


27
28
29
# File 'lib/ridley/resources/node.rb', line 27

def normal=(hash)
  super(HashWithIndifferentAccess.new(hash))
end

#override=(hash) ⇒ Object

Parameters:

  • hash (Hash)


37
38
39
# File 'lib/ridley/resources/node.rb', line 37

def override=(hash)
  super(HashWithIndifferentAccess.new(hash))
end

#set_default_attribute(key, value) ⇒ HashWithIndifferentAccess

Set a node level default attribute given the dotted path representation of the Chef attribute and value

Examples:

setting and saving a node level default attribute


obj = node.find("jwinsor-1")
obj.set_default_attribute("my_app.billing.enabled", false)
obj.save

Parameters:

  • key (String)
  • value (Object)

Returns:

  • (HashWithIndifferentAccess)


72
73
74
75
# File 'lib/ridley/resources/node.rb', line 72

def set_default_attribute(key, value)
  attr_hash = HashWithIndifferentAccess.from_dotted_path(key, value)
  self.default = self.default.merge(attr_hash)
end

#set_normal_attribute(key, value) ⇒ HashWithIndifferentAccess

Set a node level normal attribute given the dotted path representation of the Chef attribute and value

Examples:

setting and saving a node level normal attribute


obj = node.find("jwinsor-1")
obj.set_normal_attribute("my_app.billing.enabled", false)
obj.save

Parameters:

  • key (String)
  • value (Object)

Returns:

  • (HashWithIndifferentAccess)


90
91
92
93
# File 'lib/ridley/resources/node.rb', line 90

def set_normal_attribute(key, value)
  attr_hash = HashWithIndifferentAccess.from_dotted_path(key, value)
  self.normal = self.normal.merge(attr_hash)
end

#set_override_attribute(key, value) ⇒ HashWithIndifferentAccess

Set a node level override attribute given the dotted path representation of the Chef attribute and value

Examples:

setting and saving a node level override attribute


obj = node.find("jwinsor-1")
obj.set_override_attribute("my_app.billing.enabled", false)
obj.save

Parameters:

  • key (String)
  • value (Object)

Returns:

  • (HashWithIndifferentAccess)


54
55
56
57
# File 'lib/ridley/resources/node.rb', line 54

def set_override_attribute(key, value)
  attr_hash = HashWithIndifferentAccess.from_dotted_path(key, value)
  self.override = self.override.merge(attr_hash)
end