summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jacob <adam@hjksolutions.com>2009-02-26 12:13:28 -0800
committerAdam Jacob <adam@hjksolutions.com>2009-02-26 12:13:28 -0800
commit58880453ae6c6f1d466c44adcb596362782445a6 (patch)
treee695c46f8fcbe07dd9774d9d3dbd60f372b51b5d
parent95eabee78933bd83de28766d4f2d773d16ab1801 (diff)
parent7b0f3ff1db3bc139c1f6ac67e11166c57f05a6d5 (diff)
downloadohai-58880453ae6c6f1d466c44adcb596362782445a6.tar.gz
Merge branch 'master' into thommay/OHAI-54
-rw-r--r--lib/ohai/plugins/darwin/kernel.rb4
-rw-r--r--lib/ohai/plugins/freebsd/network.rb8
-rw-r--r--lib/ohai/plugins/os.rb2
3 files changed, 9 insertions, 5 deletions
diff --git a/lib/ohai/plugins/darwin/kernel.rb b/lib/ohai/plugins/darwin/kernel.rb
index 452ac987..0257dd17 100644
--- a/lib/ohai/plugins/darwin/kernel.rb
+++ b/lib/ohai/plugins/darwin/kernel.rb
@@ -18,6 +18,10 @@
kernel[:os] = kernel[:name]
+if from("sysctl -n hw.optional.x86_64").to_i == 1
+ kernel[:machine] = 'x86_64'
+end
+
kext = Mash.new
popen4("/usr/sbin/kextstat -k -l") do |pid, stdin, stdout, stderr|
stdin.close
diff --git a/lib/ohai/plugins/freebsd/network.rb b/lib/ohai/plugins/freebsd/network.rb
index 9cea08a8..421f09d8 100644
--- a/lib/ohai/plugins/freebsd/network.rb
+++ b/lib/ohai/plugins/freebsd/network.rb
@@ -48,10 +48,10 @@ popen4("/sbin/ifconfig -a") do |pid, stdin, stdout, stderr|
if line =~ /\s+inet6 ([a-f0-9\:]+)%?(\w*)\s+prefixlen\s+(\d+)\s*\w*\s*([\da-fx]*)/
iface[cint][:addresses] = Mash.new unless iface[cint][:addresses]
if $4.empty?
- iface[cint][:addresses] << { "family" => "inet6", "prefixlen" => $3 }
+ iface[cint][:addresses][$1] = { "family" => "inet6", "prefixlen" => $3 }
else
# found a zone_id / scope
- iface[cint][:addresses] << { "family" => "inet6", "zoneid" => $2, "prefixlen" => $3, "scopeid" => $4 }
+ iface[cint][:addresses][$1] = { "family" => "inet6", "zoneid" => $2, "prefixlen" => $3, "scopeid" => $4 }
end
end
if line =~ /flags=\d+<(.+)>/
@@ -70,8 +70,8 @@ popen4("arp -an") do |pid, stdin, stdout, stderr|
stdout.each do |line|
if line =~ /\((\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\) at ([a-fA-F0-9\:]+) on ([0-9a-zA-Z\.\:\-]+)/
next unless iface[$3] # this should never happen
- iface[$3][:arp] = Array.new unless iface[$3][:arp]
- iface[$3][:arp] << { $1 => $2.downcase }
+ iface[$3][:arp] = Mash.new unless iface[$3][:arp]
+ iface[$3][:arp][$1] = $2.downcase
end
end
end
diff --git a/lib/ohai/plugins/os.rb b/lib/ohai/plugins/os.rb
index a3879abe..114f75d2 100644
--- a/lib/ohai/plugins/os.rb
+++ b/lib/ohai/plugins/os.rb
@@ -25,7 +25,7 @@ when /darwin(.+)$/
when /linux/
os "linux"
when /freebsd(.+)$/
- os "freebsd"
+ os "freebsd"
else
os languages[:ruby][:host_os]
end