diff options
author | Saku Ytti <saku@ytti.fi> | 2018-06-07 23:03:53 +0300 |
---|---|---|
committer | Saku Ytti <saku@ytti.fi> | 2018-06-07 23:03:53 +0300 |
commit | 4d92efb4eca3b82ad4db7d8b0b3dff5c09eab49d (patch) | |
tree | c8a216be0550b9465c62fda1ff038ea90f4f08cd | |
parent | 8317e002588a737e01172ef8cb9272c8cc964771 (diff) |
Fix IP address assingment
Unsure what problem was being solved here originally, wish I had tests
for expected behaviour :)
-rw-r--r-- | lib/oxidized/node.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/oxidized/node.rb b/lib/oxidized/node.rb index 4105da0..04c1f08 100644 --- a/lib/oxidized/node.rb +++ b/lib/oxidized/node.rb @@ -15,9 +15,9 @@ module Oxidized ip_addr, _ = opt[:ip].to_s.split("/") Oxidized.logger.debug 'IPADDR %s' % ip_addr.to_s @name = opt[:name] - @ip = @name unless Oxidized.config.resolve_dns? - @ip ||= IPAddr.new(ip_addr).to_s rescue nil - @ip ||= Resolv.new.getaddress @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] @input = resolve_input opt @output = resolve_output opt |