Method: Oxidized::Node#initialize
- Defined in:
- lib/oxidized/node.rb
#initialize(opt) ⇒ Node
Returns a new instance of Node.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/oxidized/node.rb', line 13 def initialize(opt) Oxidized.logger.debug 'resolving DNS for %s...' % opt[:name] # remove the prefix if an IP Address is provided with one as IPAddr converts it to a network address. ip_addr, = opt[:ip].to_s.split("/") Oxidized.logger.debug 'IPADDR %s' % ip_addr.to_s @name = opt[:name] @ip = IPAddr.new(ip_addr).to_s rescue nil @ip ||= Resolv.new.getaddress(@name) if Oxidized.config.resolve_dns? @ip ||= @name @group = opt[:group] @model = resolve_model opt @input = resolve_input opt @output = resolve_output opt @auth = resolve_auth opt @prompt = resolve_prompt opt @vars = opt[:vars] @stats = Stats.new @retry = 0 @repo = resolve_repo opt @err_type = nil @err_reason = nil # model instance needs to access node instance @model.node = self end |