diff options
author | Luke Kanies <luke@madstop.com> | 2008-06-17 10:59:52 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2008-06-17 10:59:52 -0500 |
commit | ce7b74c6a5094661f2af63dbdf992a12652f7778 (patch) | |
tree | 9b6dfa55a434f2e9b017ef007753bcb8d026b127 /lib/facter/macaddress.rb | |
parent | 2ee5d29548b48a3c81f574c2be84db60f6ff306a (diff) | |
download | facter-ce7b74c6a5094661f2af63dbdf992a12652f7778.tar.gz facter-ce7b74c6a5094661f2af63dbdf992a12652f7778.tar.xz facter-ce7b74c6a5094661f2af63dbdf992a12652f7778.zip |
Rejustifying all of the whitespace in the facts, yay.
Diffstat (limited to 'lib/facter/macaddress.rb')
-rw-r--r-- | lib/facter/macaddress.rb | 120 |
1 files changed, 60 insertions, 60 deletions
diff --git a/lib/facter/macaddress.rb b/lib/facter/macaddress.rb index f42f8a1..30d4b59 100644 --- a/lib/facter/macaddress.rb +++ b/lib/facter/macaddress.rb @@ -1,65 +1,65 @@ - Facter.add(:macaddress) do - confine :operatingsystem => %w{Solaris Linux Fedora RedHat CentOS SuSE Debian Gentoo} - setcode do - ether = [] - output = %x{/sbin/ifconfig -a} - output.each {|s| - ether.push($1) if s =~ /(?:ether|HWaddr) (\w{1,2}:\w{1,2}:\w{1,2}:\w{1,2}:\w{1,2}:\w{1,2})/ - } - ether[0] - end - end - - Facter.add(:macaddress) do - confine :operatingsystem => %w{FreeBSD OpenBSD} - setcode do - ether = [] - output = %x{/sbin/ifconfig} - output.each {|s| - if s =~ /(?:ether|lladdr)\s+(\w\w:\w\w:\w\w:\w\w:\w\w:\w\w)/ - ether.push($1) - end - } - ether[0] - end - end +Facter.add(:macaddress) do + confine :operatingsystem => %w{Solaris Linux Fedora RedHat CentOS SuSE Debian Gentoo} + setcode do + ether = [] + output = %x{/sbin/ifconfig -a} + output.each {|s| + ether.push($1) if s =~ /(?:ether|HWaddr) (\w{1,2}:\w{1,2}:\w{1,2}:\w{1,2}:\w{1,2}:\w{1,2})/ + } + ether[0] + end +end - Facter.add(:macaddress) do - confine :kernel => :darwin - setcode do - ether = nil - output = %x{/sbin/ifconfig} +Facter.add(:macaddress) do + confine :operatingsystem => %w{FreeBSD OpenBSD} + setcode do + ether = [] + output = %x{/sbin/ifconfig} + output.each {|s| + if s =~ /(?:ether|lladdr)\s+(\w\w:\w\w:\w\w:\w\w:\w\w:\w\w)/ + ether.push($1) + end + } + ether[0] + end +end - output.split(/^\S/).each { |str| - if str =~ /10baseT/ # we're wired - str =~ /ether (\w\w:\w\w:\w\w:\w\w:\w\w:\w\w)/ - ether = $1 - end - } +Facter.add(:macaddress) do + confine :kernel => :darwin + setcode do + ether = nil + output = %x{/sbin/ifconfig} - ether + output.split(/^\S/).each { |str| + if str =~ /10baseT/ # we're wired + str =~ /ether (\w\w:\w\w:\w\w:\w\w:\w\w:\w\w)/ + ether = $1 end - end - - Facter.add(:macaddress) do - confine :kernel => %w{AIX} - setcode do - ether = [] - ip = nil - output = %x{/usr/sbin/ifconfig -a} - output.each { |str| - if str =~ /([a-z]+\d+): flags=/ - devname = $1 - unless devname =~ /lo0/ - output2 = %x{/usr/bin/entstat #{devname}} - output2.each { |str2| - if str2 =~ /^Hardware Address: (\w{1,2}:\w{1,2}:\w{1,2}:\w{1,2}:\w{1,2}:\w{1,2})/ - ether.push($1) - end - } - end - end - } - ether[0] + } + + ether + end +end + +Facter.add(:macaddress) do + confine :kernel => %w{AIX} + setcode do + ether = [] + ip = nil + output = %x{/usr/sbin/ifconfig -a} + output.each { |str| + if str =~ /([a-z]+\d+): flags=/ + devname = $1 + unless devname =~ /lo0/ + output2 = %x{/usr/bin/entstat #{devname}} + output2.each { |str2| + if str2 =~ /^Hardware Address: (\w{1,2}:\w{1,2}:\w{1,2}:\w{1,2}:\w{1,2}:\w{1,2})/ + ether.push($1) + end + } + end end - end + } + ether[0] + end +end |