From 61c128c95ffbcdff0e379d8b005c287db54c5cc3 Mon Sep 17 00:00:00 2001 From: Saku Ytti Date: Sat, 21 Feb 2015 15:53:46 +0200 Subject: allow setting IP from source sql/csv can now set IP as well as name, useful if you don't have FQDN. If IP is given, then we don't try to resolve name. closes #78 --- CHANGELOG.md | 1 + lib/oxidized/node.rb | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d7b664..2dcc284 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ # 0.3.1 +- FEATURE: allow setting IP address in addition to name in source (SQL/CSV) - BUGFIX: xos while using telnet (by @fhibler) - BUGFIX: ironware logout on some models (by @fhibler) diff --git a/lib/oxidized/node.rb b/lib/oxidized/node.rb index 6bc2b0f..2d41600 100644 --- a/lib/oxidized/node.rb +++ b/lib/oxidized/node.rb @@ -10,7 +10,8 @@ module Oxidized alias :running? :running def initialize opt @name = opt[:name] - @ip = Resolv.getaddress @name + @ip = IPAddr.new(opt[:ip]).to_s rescue nil + @ip ||= Resolv.getaddress @name @group = opt[:group] @input = resolve_input opt @output = resolve_output opt -- cgit v1.2.1