class OS::Puppet::Fencing::Config

Attributes

nodes[R]

Public Class Methods

new(config_hash) click to toggle source
# File lib/fencing/config.rb, line 9
def initialize(config_hash)
        @config = config_hash
global_blocker_config = config_hash['blocker']
@global_blocker = Blocker.new(global_blocker_config) if global_blocker_config
@nodes = []

config_hash['hosts'].each do | host_prefix, conf|
    node_name = conf
    blocker = @global_blocker
    if(conf.class == Hash)
        node_name = conf['node_name']
        blocker_conf = conf['blocker'] 
        blocker = blocker_conf ? Blocker.new(conf['blocker']) : global_blocker
    end
    nodes << Node.new(host_prefix, node_name, blocker)
end

end

Public Instance Methods

global_blocker() click to toggle source
# File lib/fencing/config.rb, line 35
def global_blocker
    @global_blocker
end
match_node(host_name) click to toggle source
# File lib/fencing/config.rb, line 28
def match_node(host_name)
    nodes.each do | node |
        return node if host_name.start_with?(node.host_prefix)
    end
    raise "Could not find configuration for host #{host_name}"
end