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

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


The following commit has been merged in the upstream branch:
commit 9376e5bf883dc9460a4e19c7952c7c996f43e0e3
Author: James Turnbull <james at lovedthanlost.net>
Date:   Sat Mar 7 02:47:52 2009 +1100

    Fixed #2044 - virtual fact thread fix

diff --git a/CHANGELOG b/CHANGELOG
index da7478d..b0336aa 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,6 @@
 1.6.x:
+    Fixed #2044 - fixed virtual fact
+
     Fixed lib install permissions
 
     Fixed #2040 - Facter should provide a macosx_productversion_major fact
diff --git a/lib/facter/virtual.rb b/lib/facter/virtual.rb
index 8150718..2c92532 100644
--- a/lib/facter/virtual.rb
+++ b/lib/facter/virtual.rb
@@ -4,6 +4,8 @@ Facter.add("virtual") do
     result = "physical"
 
     setcode do
+    require 'thread'
+
         if FileTest.exists?("/proc/user_beancounters")
             # openvz. can be hardware node or virtual environment
             # read the init process' status file, it has laxer permissions
@@ -16,13 +18,15 @@ Facter.add("virtual") do
             end
         end
 
-        if FileTest.exists?("/proc/xen/capabilities") && FileTest.readable?("/proc/xen/capabilities")
-            txt = File.read("/proc/xen/capabilities")
-            if txt =~ /control_d/i
-                result = "xen0"
-            else
-                result = "xenu"
-            end
+        Thread::exclusive do
+            if FileTest.exists?("/proc/xen/capabilities") && FileTest.readable?("/proc/xen/capabilities")
+                txt = File.read("/proc/xen/capabilities")
+                    if txt =~ /control_d/i
+                        result = "xen0"
+                    else
+                        result = "xenu"
+                    end
+             end
         end
 
         if result == "physical"

-- 
Packaging of Facter for debian



More information about the Pkg-puppet-devel mailing list