Module: Capichef::Node

Defined in:
lib/capichef/node.rb

Class Method Summary collapse

Class Method Details

.get_attribute(node, attribute) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/capichef/node.rb', line 7

def self.get_attribute(node, attribute)
  case attribute
  when Proc
    role name, attribute.call(node)
  when Hash
    iface, family = attribute.keys.first.to_s, attribute.values.first.to_s
    addresses = node["network"]["interfaces"][iface]["addresses"]
    role name,  addresses.select{|address, data| data["family"] == family }.to_a.first.first
  when Symbol, String
    role name, node[attribute.to_s].to_s
  else
    raise ArgumentError, 'Attribute must be Proc, Hash, Symbol, String.'
  end
end

.load_into(configuration) ⇒ Object



22
23
24
25
26
# File 'lib/capichef/node.rb', line 22

def self.load_into(configuration)
  configuration.load do
          
  end
end