diff options
author | James Turnbull <james@lovedthanlost.net> | 2009-04-27 00:00:56 +1000 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-04-27 00:00:56 +1000 |
commit | 636a91de9304caf32d179b7de5ca6dca296a7f2c (patch) | |
tree | e2db552b82a7d6d563443538c492acde2a690709 /lib/facter/macaddress.rb | |
parent | 9df0583dcb6f8ea6d815bceb3da33d2cb7449f08 (diff) | |
download | facter-636a91de9304caf32d179b7de5ca6dca296a7f2c.tar.gz facter-636a91de9304caf32d179b7de5ca6dca296a7f2c.tar.xz facter-636a91de9304caf32d179b7de5ca6dca296a7f2c.zip |
Partial fix for #2191 - Facter compatibility for Ruby 1.9
Diffstat (limited to 'lib/facter/macaddress.rb')
-rw-r--r-- | lib/facter/macaddress.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/facter/macaddress.rb b/lib/facter/macaddress.rb index e048209..94d00f4 100644 --- a/lib/facter/macaddress.rb +++ b/lib/facter/macaddress.rb @@ -3,7 +3,7 @@ Facter.add(:macaddress) do setcode do ether = [] output = %x{/sbin/ifconfig -a} - output.each do |s| + output.each_line do |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})/ end ether[0] @@ -15,7 +15,7 @@ Facter.add(:macaddress) do setcode do ether = [] output = %x{/sbin/ifconfig} - output.each do |s| + output.each_line do |s| if s =~ /(?:ether|lladdr)\s+(\w\w:\w\w:\w\w:\w\w:\w\w:\w\w)/ ether.push($1) end @@ -30,7 +30,7 @@ Facter.add(:macaddress) do ether = nil output = %x{/sbin/ifconfig} - output.split(/^\S/).each do |str| + output.split(/^\S/).each_line do |str| if str =~ /10baseT/ # we're wired str =~ /ether (\w\w:\w\w:\w\w:\w\w:\w\w:\w\w)/ ether = $1 @@ -47,12 +47,12 @@ Facter.add(:macaddress) do ether = [] ip = nil output = %x{/usr/sbin/ifconfig -a} - output.each do |str| + output.each_line do |str| if str =~ /([a-z]+\d+): flags=/ devname = $1 unless devname =~ /lo0/ output2 = %x{/usr/bin/entstat #{devname}} - output2.each do |str2| + output2.each_line do |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 @@ -69,7 +69,7 @@ Facter.add(:macaddress) do setcode do ether = [] output = %x{ipconfig /all} - output.split(/\r\n/).each do |str| + output.split(/\r\n/).each_line do |str| if str =~ /.*Physical Address.*: (\w{1,2}-\w{1,2}-\w{1,2}-\w{1,2}-\w{1,2}-\w{1,2})/ ether.push($1.gsub(/-/, ":")) end |