[Pkg-puppet-devel] [SCM] Packaging of Facter for debian branch, upstream, updated. 3a39dd8353b6308cf49522990104cc63e55d7cda
James Turnbull
james at lovedthanlost.net
Fri Jan 29 17:22:24 UTC 2010
The following commit has been merged in the upstream branch:
commit 831d937a88e6de9e2e4ff8c3bfe025abfd2ac99a
Author: James Turnbull <james at lovedthanlost.net>
Date: Wed May 13 11:12:29 2009 +1000
Refactor #2154 - Modified patch from Benedikt Bohm to simplify openvz and vserver detection
diff --git a/lib/facter/virtual.rb b/lib/facter/virtual.rb
index 907f9ca..203d306 100644
--- a/lib/facter/virtual.rb
+++ b/lib/facter/virtual.rb
@@ -13,18 +13,25 @@ Facter.add("virtual") do
end
end
- if FileTest.exists?("/proc/user_beancounters")
- # openvz. can be hardware node or virtual environment
- # read the init process' status file, it has laxer permissions
- # than /proc/user_beancounters (so this won't fail as non-root)
- txt = File.read("/proc/1/status")
- if txt =~ /^envID:[[:blank:]]+0$/mi
+ if FileTest.exists?("/proc/vz/veinfo")
+ if FileTest.exists?("/proc/vz/version")
result = "openvzhn"
else
result = "openvzve"
end
end
+ if FileTest.exists?("/proc/self/status")
+ txt = File.read("/proc/self/status")
+ if txt =~ /^(s_context|VxID):[[:blank:]]*[1-9]/
+ result = "vserver"
+ end
+ end
+
+ if FileTest.exists?("/proc/virtual")
+ result = "vserver_host"
+ end
+
# new Xen domains have this in dom0 not domu :(
if FileTest.exists?("/proc/sys/xen/independent_wallclock")
result = "xenu"
@@ -70,17 +77,6 @@ Facter.add("virtual") do
result = "vmware_server"
end
- output = Facter::Util::Resolution.exec('mount')
- if not output.nil?
- output.each_line do |p|
- result = "vserver" if p =~ /\/dev\/hdv1/
- end
- end
-
- if FileTest.directory?('/proc/virtual') && result=="physical"
- result = "vserver_host"
- end
-
result
end
end
--
Packaging of Facter for debian
More information about the Pkg-puppet-devel
mailing list