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

Ben Hughes ben at puppetlabs.com
Wed Jun 22 08:51:51 UTC 2011


The following commit has been merged in the experimental_upstream branch:
commit 19f96b59081558eefd613770fdf8c5f5665a150b
Author: Ben Hughes <ben at puppetlabs.com>
Date:   Thu Apr 7 11:33:09 2011 +1000

    (#6728) Facter improperly detects openvzve on CloudLinux systems
    
    Make the openvz check for more than just the vz directory to be sure it's
    OpenVZ.
    
    Update the OpenVZ fact to be slightly more resilient in it's checking of
    OpenVZ, so it doesn't clash with CloudLinux's LVE container system.

diff --git a/lib/facter/util/virtual.rb b/lib/facter/util/virtual.rb
index 4355451..8bdde16 100644
--- a/lib/facter/util/virtual.rb
+++ b/lib/facter/util/virtual.rb
@@ -1,6 +1,6 @@
 module Facter::Util::Virtual
     def self.openvz?
-        FileTest.directory?("/proc/vz")
+        FileTest.directory?("/proc/vz") and FileTest.exists?( '/proc/vz/veinfo' )
     end
 
     def self.openvz_type
diff --git a/spec/unit/util/virtual_spec.rb b/spec/unit/util/virtual_spec.rb
index aa2de5a..36e1bf1 100644
--- a/spec/unit/util/virtual_spec.rb
+++ b/spec/unit/util/virtual_spec.rb
@@ -9,6 +9,7 @@ describe Facter::Util::Virtual do
     end
     it "should detect openvz" do
         FileTest.stubs(:directory?).with("/proc/vz").returns(true)
+        FileTest.stubs(:exists?).with("/proc/vz/veinfo").returns(true)
         Facter::Util::Virtual.should be_openvz
     end
 

-- 
Packaging of Facter for debian



More information about the Pkg-puppet-devel mailing list