[Pkg-puppet-devel] [SCM] Packaging of Facter for debian branch, upstream, updated. 3a39dd8353b6308cf49522990104cc63e55d7cda

James Turnbull james at lovedthanlost.net
Fri Jan 29 17:22:17 UTC 2010


The following commit has been merged in the upstream branch:
commit a6d6ba5454a805cf95a7aa4def0c12afc180b958
Author: Peter Meier <peter.meier at immerda.ch>
Date:   Tue Mar 10 21:33:29 2009 +0100

    Use resultion.exec util instead of which checks
    
    Use rather our util to exec commands than implementing our own hack.

diff --git a/lib/facter/virtual.rb b/lib/facter/virtual.rb
index 2c92532..97d7cba 100644
--- a/lib/facter/virtual.rb
+++ b/lib/facter/virtual.rb
@@ -30,25 +30,22 @@ Facter.add("virtual") do
         end
 
         if result == "physical"
-            path = %x{which lspci 2> /dev/null}.chomp
-            if path !~ /no lspci/
-                output = %x{#{path}}
+            output = Facter::Util::Resolution.exec('lspci')
+            if not output.nil?
                 output.each 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
-                path = %x{which dmidecode 2> /dev/null}.chomp
-                if path !~ /no dmidecode/
-                    output = %x{#{path}}
+                output = Facter::Util::Resolution.exec('dmidecode')
+                if not output.nil?
                     output.each do |pd|
                         result = "vmware" if pd =~ /VMware|Parallels/
                     end
                 else
-                    path = %x{which prtdiag 2> /dev/null}.chomp
-                    if path !~ /no prtdiag/
-                        output = %x{#{path}}
+                    output = Facter::Util::Resolution.exec('prtdiag')
+                    if not output.nil?
                         output.each do |pd|
                             result = "vmware" if pd =~ /VMware|Parallels/
                         end
@@ -62,9 +59,8 @@ Facter.add("virtual") do
             result = "vmware_server"
         end
 
-        mountexists = system "which mount > /dev/null 2>&1"
-        if $?.exitstatus == 0
-            output = %x{mount}
+        output = Facter::Util::Resolution.exec('mount')
+        if not output.nil?
             output.each do |p|
                 result = "vserver" if p =~ /\/dev\/hdv1/
             end

-- 
Packaging of Facter for debian



More information about the Pkg-puppet-devel mailing list