[Pkg-puppet-devel] [SCM] Packaging of Facter for debian branch, experimental_upstream, updated. 1.5.9-54-g5a4eeed

James Turnbull james at lovedthanlost.net
Wed Jun 22 08:51:49 UTC 2011


The following commit has been merged in the experimental_upstream branch:
commit 68a125c56b65ecadcbe92ecb4bafb28731706e57
Merge: cf029c3d59b583afd2ce26ec335c6d5b49b166ba f6c9927b6450894fc7036881eab5ff2fb9524e71
Author: James Turnbull <james at lovedthanlost.net>
Date:   Wed Apr 6 02:15:32 2011 +1000

    Merge remote branch 'adrien/tickets/next/6719' into next
    
    * adrien/tickets/next/6719:
      (#6719) Corrected faulty logic in bugfix
    
    Conflicts:
    	lib/facter/virtual.rb

diff --combined lib/facter/virtual.rb
index 2801a43,3c2d10f..a583995
--- a/lib/facter/virtual.rb
+++ b/lib/facter/virtual.rb
@@@ -1,30 -1,3 +1,30 @@@
 +# Fact: virtual
 +#
 +# Purpose: Determine if the system's hardware is real or virtualised.
 +#
 +# Resolution:
 +#   Assumes physical unless proven otherwise.
 +#
 +#   On Darwin, use the macosx util module to acquire the SPDisplaysDataType,
 +#   from that parse it to see if it's VMWare or Parallels pretending to be the
 +#   display.
 +#
 +#   On Linux, BSD, Solaris and HPUX:
 +#     Much of the logic here is obscured behind util/virtual.rb, which rather
 +#     than document here, which would encourage drift, just refer to it.
 +#   The Xen tests in here rely on /sys and /proc, and check for the presence and
 +#   contents of files in there.
 +#   If after all the other tests, it's still seen as physical, then it tries to
 +#   parse the output of the "lspci", "dmidecode" and "prtdiag" and parses them
 +#   for obvious signs of being under VMWare or Parallels.
 +#   Finally it checks for the existence of vmware-vmx, which would hint it's
 +#   VMWare.
 +#
 +# Caveats:
 +#   Virtualbox detection isn't implemented. 
 +#   Many checks rely purely on existence of files.
 +#
 +
  require 'facter/util/virtual'
  
  Facter.add("virtual") do
@@@ -52,7 -25,7 +52,7 @@@ Facter.add("virtual") d
  
      setcode do
  
-         if Facter::Util::Virtual.zone? and Facter.value(:operatingsystem) == "Solaris"
+         if Facter.value(:operatingsystem) == "Solaris" and Facter::Util::Virtual.zone?
              result = "zone"
          end
  
@@@ -104,9 -77,6 +104,9 @@@
                      # --- 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/
 +                    # --- look for virtualbox video card to determine if it is virtual => virtualbox.
 +                    # ---     00:02.0 VGA compatible controller: InnoTek Systemberatung GmbH VirtualBox Graphics Adapter
 +                    result = "virtualbox" if p =~ /VirtualBox/
                      # --- look for pci vendor id used by Parallels video card
                      # ---   01:00.0 VGA compatible controller: Unknown device 1ab8:4005
                      result = "parallels" if p =~ /1ab8:|[Pp]arallels/
@@@ -117,23 -87,18 +117,23 @@@
                      output.each_line do |pd|
                          result = "parallels" if pd =~ /Parallels/
                          result = "vmware" if pd =~ /VMware/
 +                        result = "virtualbox" if pd =~ /VirtualBox/
                      end
 -                else
 -                    output = Facter::Util::Resolution.exec('prtdiag')
 +                elsif Facter.value(:kernel) == 'SunOS'
 +                    res = Facter::Util::Resolution.new('prtdiag')
 +                    res.timeout = 6
 +                    res.setcode('prtdiag')
 +                    output = res.value
                      if not output.nil?
                          output.each_line do |pd|
                              result = "parallels" if pd =~ /Parallels/
                              result = "vmware" if pd =~ /VMware/
 +							result = "virtualbox" if pd =~ /VirtualBox/
                          end
                      end
                  end
              end
 -            # VMware server 1.0.3 rpm places vmware-vmx in this place, other versions or platforms may not.
 +            
              if FileTest.exists?("/usr/lib/vmware/bin/vmware-vmx")
                  result = "vmware_server"
              end
@@@ -143,17 -108,6 +143,17 @@@
      end
  end
  
 +# Fact: is_virtual
 +#
 +# Purpose: returning true or false for if a machine is virtualised or not.
 +#
 +# Resolution: The Xen domain 0 machine is virtualised to a degree, but is generally
 +# not viewed as being a virtual machine. This checks that the machine is not
 +# physical nor xen0, if that is the case, it is virtual.
 +#
 +# Caveats:
 +#
 +
  Facter.add("is_virtual") do
      confine :kernel => %w{Linux FreeBSD OpenBSD SunOS HP-UX Darwin GNU/kFreeBSD}
  

-- 
Packaging of Facter for debian



More information about the Pkg-puppet-devel mailing list