diff options
author | James Turnbull <james@lovedthanlost.net> | 2007-09-16 10:26:45 +1000 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2007-09-16 10:26:45 +1000 |
commit | dce624579b327963cc1619e93020d3ccb59995bd (patch) | |
tree | 67cd2297cddacee74847b36fe8f37b87356d104e | |
parent | c5e6f602ae71d43ec58b65ec6b2f4f540bc27649 (diff) | |
download | facter-dce624579b327963cc1619e93020d3ccb59995bd.tar.gz facter-dce624579b327963cc1619e93020d3ccb59995bd.tar.xz facter-dce624579b327963cc1619e93020d3ccb59995bd.zip |
Revert "Adjusted :kernel confine to make it more in line with others"
This reverts commit c5e6f602ae71d43ec58b65ec6b2f4f540bc27649.
-rw-r--r-- | CHANGELOG | 2 | ||||
-rw-r--r-- | lib/facter.rb | 2 | ||||
-rw-r--r-- | lib/facter/ipmess.rb | 24 |
3 files changed, 14 insertions, 14 deletions
@@ -2,7 +2,7 @@ Added support to return multiple interfaces and their IP addresses and MAC addressess as facts. Returns interface_interfacename and macaddress_interfacename. Existing ipaddress and macaddress facts are - unchanged and still returned. Supports bith Linux and BSD. Closes #6. + unchanged and still returned. Currently Linux only. Closes #6. Added macaddress fact support for FreeBSD and OpenBSD - closes #37 diff --git a/lib/facter.rb b/lib/facter.rb index 802f848..e71eb0c 100644 --- a/lib/facter.rb +++ b/lib/facter.rb @@ -1004,7 +1004,7 @@ class Facter end end Facter.add(:ipaddress) do - confine :kernel => %w{NetBSD} + confine :kernel => %w{NetBSD} setcode do ip = nil output = %x{/sbin/ifconfig -a} diff --git a/lib/facter/ipmess.rb b/lib/facter/ipmess.rb index 777084f..abee8a2 100644 --- a/lib/facter/ipmess.rb +++ b/lib/facter/ipmess.rb @@ -44,7 +44,7 @@ if Facter.kernel == "Linux" confine :kernel => :linux setcode do fact - end + end end } } @@ -52,16 +52,16 @@ end if Facter.kernel == "FreeBSD" || Facter.kernel == "OpenBSD" || Facter.kernel == "NetBSD" - output = %x{/sbin/ifconfig -a} - int = nil - output.scan(/^(\w+)(\d+):/) { |str| - output_int = %x{/sbin/ifconfig #{str}} - int = "#{str}" - tmp1 = nil - tmp2 = nil - test = {} - output_int.each { |s| - int = "#{str}" + output = %x{/sbin/ifconfig -a} + int = nil + output.scan(/^(\w+)(\d+):/) { |str| + output_int = %x{/sbin/ifconfig #{str}} + int = "#{str}" + tmp1 = nil + tmp2 = nil + test = {} + output_int.each { |s| + int = "#{str}" tmp1 = $1 if s =~ /inet ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/ tmp2 = $1 if s =~ /(?:ether|lladdr)\s+(\w\w:\w\w:\w\w:\w\w:\w\w:\w\w)/ if tmp1 != nil && tmp2 != nil && int != "lo" @@ -71,7 +71,7 @@ if Facter.kernel == "FreeBSD" || Facter.kernel == "OpenBSD" || Facter.kernel == tmp1 = nil tmp2 = nil end - } + } test.each{|name,fact| Facter.add(name) do confine :kernel => :linux |