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

Signed-off-by: Paul Nasrat <[email protected]>
---
 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
-- 
1.6.1.3


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to