diff options
author | Saku Ytti <saku@ytti.fi> | 2015-02-21 15:53:46 +0200 |
---|---|---|
committer | Saku Ytti <saku@ytti.fi> | 2015-02-21 15:56:28 +0200 |
commit | 61c128c95ffbcdff0e379d8b005c287db54c5cc3 (patch) | |
tree | 80e2cff2ea41612dc0938751226b3d289a40a708 | |
parent | 1a9a8143d89bcdf8ac336edd1c9d262f68055306 (diff) |
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
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | lib/oxidized/node.rb | 3 |
2 files changed, 3 insertions, 1 deletions
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 |