summaryrefslogtreecommitdiffstats
path: root/lib/facter/virtual.rb
diff options
context:
space:
mode:
authorJim Pirzyk <jim+puppet@pirzyk.org>2009-05-15 08:27:23 +0100
committerPaul Nasrat <pnasrat@googlemail.com>2009-05-15 08:27:23 +0100
commit56760d34f070db4d7bb8e5fcfb7939fe3074bf49 (patch)
treef83ec0f427f9d49bf8359277b8b0a51f5a7e29fe /lib/facter/virtual.rb
parent2fb91caa311ea20f8342289050c367f30a610827 (diff)
downloadfacter-56760d34f070db4d7bb8e5fcfb7939fe3074bf49.tar.gz
facter-56760d34f070db4d7bb8e5fcfb7939fe3074bf49.tar.xz
facter-56760d34f070db4d7bb8e5fcfb7939fe3074bf49.zip
Facter #2120 - Solaris support for Facter[virtual]
Initial support for virtual vmware fact on Solaris Tested on VMWare Fusion and OpenSolaris Paul
Diffstat (limited to 'lib/facter/virtual.rb')
-rw-r--r--lib/facter/virtual.rb28
1 files changed, 17 insertions, 11 deletions
diff --git a/lib/facter/virtual.rb b/lib/facter/virtual.rb
index 203d306..37381d4 100644
--- a/lib/facter/virtual.rb
+++ b/lib/facter/virtual.rb
@@ -48,25 +48,31 @@ Facter.add("virtual") do
end
if result == "physical"
- output = Facter::Util::Resolution.exec('lspci')
- if not output.nil?
- 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/
- end
+ output = Facter::Util::Resolution.exec('vmware-checkvm')
+ if $?.exitstatus == 0
+ result = "vmware"
else
- output = Facter::Util::Resolution.exec('dmidecode')
+ output = Facter::Util::Resolution.exec('lspci')
if not output.nil?
- output.each_line do |pd|
- result = "vmware" if pd =~ /VMware|Parallels/
+ 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/
end
else
- output = Facter::Util::Resolution.exec('prtdiag')
+ output = Facter::Util::Resolution.exec('dmidecode')
if not output.nil?
output.each_line do |pd|
result = "vmware" if pd =~ /VMware|Parallels/
end
+ elsif Facter[:kernel].value == 'SunOS' and Facter[:kernelrelease].value == '5.10'
+ # prtdiag only works on Solaris 10 x86 hosts
+ output = Facter::Util::Resolution.exec('prtdiag')
+ if not output.nil?
+ output.each_line do |pd|
+ result = "vmware" if pd =~ /VMware|Parallels/
+ end
+ end
end
end
end