[Pkg-puppet-devel] [SCM] Packaging of Facter for debian branch, upstream, updated. 3a39dd8353b6308cf49522990104cc63e55d7cda
James Turnbull
james at lovedthanlost.net
Fri Jan 29 17:22:21 UTC 2010
The following commit has been merged in the upstream branch:
commit 636a91de9304caf32d179b7de5ca6dca296a7f2c
Author: James Turnbull <james at lovedthanlost.net>
Date: Mon Apr 27 00:00:56 2009 +1000
Partial fix for #2191 - Facter compatibility for Ruby 1.9
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
diff --git a/lib/facter/util/ip.rb b/lib/facter/util/ip.rb
index 374d9f3..a2125ea 100644
--- a/lib/facter/util/ip.rb
+++ b/lib/facter/util/ip.rb
@@ -120,7 +120,7 @@ module Facter::Util::IP
output_int = get_single_interface_output(interface)
if interface != /^lo[0:]?\d?/
- output_int.each do |s|
+ output_int.each_line do |s|
if s =~ regex
value = $1
if label == 'netmask' && convert_from_hex?(kernel)
diff --git a/lib/facter/virtual.rb b/lib/facter/virtual.rb
index 97d7cba..3ad6f8a 100644
--- a/lib/facter/virtual.rb
+++ b/lib/facter/virtual.rb
@@ -32,7 +32,7 @@ Facter.add("virtual") do
if result == "physical"
output = Facter::Util::Resolution.exec('lspci')
if not output.nil?
- output.each do |p|
+ output.each_line do |p|
# --- look for the vmware video card to determine if it is virtual => vmware.
# --- 00:0f.0 VGA compatible controller: VMware Inc [VMware SVGA II] PCI Display Adapter
result = "vmware" if p =~ /VM[wW]are/
@@ -40,13 +40,13 @@ Facter.add("virtual") do
else
output = Facter::Util::Resolution.exec('dmidecode')
if not output.nil?
- output.each do |pd|
+ output.each_line do |pd|
result = "vmware" if pd =~ /VMware|Parallels/
end
else
output = Facter::Util::Resolution.exec('prtdiag')
if not output.nil?
- output.each do |pd|
+ output.each_line do |pd|
result = "vmware" if pd =~ /VMware|Parallels/
end
end
@@ -61,7 +61,7 @@ Facter.add("virtual") do
output = Facter::Util::Resolution.exec('mount')
if not output.nil?
- output.each do |p|
+ output.each_line do |p|
result = "vserver" if p =~ /\/dev\/hdv1/
end
end
--
Packaging of Facter for debian
More information about the Pkg-puppet-devel
mailing list