diff options
author | ytti <saku@ytti.fi> | 2017-02-03 22:49:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-03 22:49:41 +0200 |
commit | 408e192999e9c414da35a23de199de99c07e7a6a (patch) | |
tree | a6e2024b3695dccd4bdbf2269c5141a46736bf1a /lib | |
parent | 54f0b065f35c6a742f6bab10611eb1091f0948d0 (diff) | |
parent | 152763ea997b6dc54b79921fa424436b331694b2 (diff) |
Merge pull request #690 from InsaneSplash/drop-network-prefix
feature: support an IP Address provided with a netmask
Diffstat (limited to 'lib')
-rw-r--r-- | lib/oxidized/node.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/oxidized/node.rb b/lib/oxidized/node.rb index b13ce0e..6f89b56 100644 --- a/lib/oxidized/node.rb +++ b/lib/oxidized/node.rb @@ -10,8 +10,11 @@ module Oxidized alias :running? :running 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(opt[:ip]).to_s rescue nil + @ip = IPAddr.new(ip_addr).to_s rescue nil @ip ||= Resolv.new.getaddress @name @group = opt[:group] @input = resolve_input opt |