From 4d92efb4eca3b82ad4db7d8b0b3dff5c09eab49d Mon Sep 17 00:00:00 2001 From: Saku Ytti Date: Thu, 7 Jun 2018 23:03:53 +0300 Subject: Fix IP address assingment Unsure what problem was being solved here originally, wish I had tests for expected behaviour :) --- lib/oxidized/node.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/oxidized/node.rb') 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 -- cgit v1.2.1