summaryrefslogtreecommitdiffstats
path: root/lib/facter/operatingsystem.rb
diff options
context:
space:
mode:
authorJames Turnbull <james@lovedthanlost.net>2011-03-15 18:09:35 +1100
committerJames Turnbull <james@lovedthanlost.net>2011-03-17 07:19:19 +1100
commite917e1a7f47b4399f5d1dd32dd5cd8ad5da86b64 (patch)
treed2c4672c4663bde7eff23e1b8376e11ae23d672c /lib/facter/operatingsystem.rb
parentd0f0f63f91a0eff72c1c528a6b5fb325bd9001d4 (diff)
downloadfacter-e917e1a7f47b4399f5d1dd32dd5cd8ad5da86b64.tar.gz
facter-e917e1a7f47b4399f5d1dd32dd5cd8ad5da86b64.tar.xz
facter-e917e1a7f47b4399f5d1dd32dd5cd8ad5da86b64.zip
Fixed #3087 - Identify VMWare
Added support for VMWareESX and ESXi to operatingsystem and operatingsystemrelease facts Added appropriate tests
Diffstat (limited to 'lib/facter/operatingsystem.rb')
-rw-r--r--lib/facter/operatingsystem.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/facter/operatingsystem.rb b/lib/facter/operatingsystem.rb
index 1675909..25eeb00 100644
--- a/lib/facter/operatingsystem.rb
+++ b/lib/facter/operatingsystem.rb
@@ -32,6 +32,8 @@ Facter.add(:operatingsystem) do
end
elsif FileTest.exists?("/etc/arch-release")
"Arch"
+ elsif FileTest.exists?("/etc/vmware-release")
+ "VMWareESX"
elsif FileTest.exists?("/etc/redhat-release")
txt = File.read("/etc/redhat-release")
if txt =~ /centos/i
@@ -63,6 +65,13 @@ Facter.add(:operatingsystem) do
end
Facter.add(:operatingsystem) do
+ confine :kernel => "VMkernel"
+ setcode do
+ "ESXi"
+ end
+end
+
+Facter.add(:operatingsystem) do
# Default to just returning the kernel as the operating system
setcode do Facter[:kernel].value end
end