diff options
author | Paul Nasrat <pnasrat@googlemail.com> | 2009-05-22 08:20:46 +0100 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-05-22 23:25:17 +1000 |
commit | 68e0b243d2098c7e83187a119baabeaac5acb81d (patch) | |
tree | ecc4da6d6a03658e9648a21d96a34aeae907ed23 /lib/facter/virtual.rb | |
parent | b533e78689951cdf5989cb1014680958c903ab9e (diff) | |
download | facter-68e0b243d2098c7e83187a119baabeaac5acb81d.tar.gz facter-68e0b243d2098c7e83187a119baabeaac5acb81d.tar.xz facter-68e0b243d2098c7e83187a119baabeaac5acb81d.zip |
Fix #2278 Revert fix for 2120
Facter #2120 - Solaris support for Facter[virtual]
This reverts commit 56760d34f070db4d7bb8e5fcfb7939fe3074bf49.
This patch is broken as $? global will report last run process in the case of
no vmware-checkvm binary
Diffstat (limited to 'lib/facter/virtual.rb')
-rw-r--r-- | lib/facter/virtual.rb | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/lib/facter/virtual.rb b/lib/facter/virtual.rb index 37381d4..203d306 100644 --- a/lib/facter/virtual.rb +++ b/lib/facter/virtual.rb @@ -48,31 +48,25 @@ Facter.add("virtual") do end if result == "physical" - output = Facter::Util::Resolution.exec('vmware-checkvm') - if $?.exitstatus == 0 - result = "vmware" + 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 else - output = Facter::Util::Resolution.exec('lspci') + output = Facter::Util::Resolution.exec('dmidecode') 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/ + output.each_line do |pd| + result = "vmware" if pd =~ /VMware|Parallels/ end else - output = Facter::Util::Resolution.exec('dmidecode') + output = Facter::Util::Resolution.exec('prtdiag') 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 |