class KnifeSous::Node

Attributes

config[R]
name[R]

Public Class Methods

new(name, config_args={}) click to toggle source
# File lib/knife_sous/node.rb, line 10
def initialize(name, config_args={})
  @name = name.to_s
  @config = {}
  update_config(config_args)
end

Public Instance Methods

config_aliases() click to toggle source
# File lib/knife_sous/node.rb, line 36
def config_aliases
  {
    ssh_config_file: :ssh_config,
    ip: :hostname
  }
end
convert_aliases(config_hash = {}) click to toggle source
# File lib/knife_sous/node.rb, line 22
def convert_aliases(config_hash = {})
  config_aliases.each do |key, value|
    if config_hash.has_key?(key)
      config_hash[value] = config_hash[key]
      config_hash.delete(key)
    end
  end
  config_hash
end
method_missing(method_name, *args, &block) click to toggle source
# File lib/knife_sous/node.rb, line 32
def method_missing(method_name, *args, &block)
  @config[method_name.to_sym]
end
update_config(other_config={}) click to toggle source
# File lib/knife_sous/node.rb, line 16
def update_config(other_config={})
  config = convert_aliases(normalize_hash(other_config))
  @config[:chef_node_name] = @name
  @config.merge!(config)
end