summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG6
-rw-r--r--lib/facter/virtual.rb10
2 files changed, 14 insertions, 2 deletions
diff --git a/CHANGELOG b/CHANGELOG
index afd863f..6a2c06f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,9 +1,13 @@
1.5.x:
Fixed #1619 - Applying patch by seanmil, adding support for SLES.
+
+ Fixed #1634 - Update virtual fact to differentiate OpenVZ
+ hardware nodes and virtual environments
Fixed #1509 - Fixed version recognition for SLES.
- Fixes #1582 - Fix MAC address reporting for Linux bonding slave interfaces
+ Fixes #1582 - Fix MAC address reporting for Linux bonding
+ slave interfaces
Fixed #1575 - CentOS fix for Facter SPEC file
diff --git a/lib/facter/virtual.rb b/lib/facter/virtual.rb
index 4404ae9..fd05d43 100644
--- a/lib/facter/virtual.rb
+++ b/lib/facter/virtual.rb
@@ -8,7 +8,15 @@ Facter.add("virtual") do
setcode do
if FileTest.exists?("/proc/user_beancounters")
- result = "openvz"
+ # 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
+ result = "openvzhn"
+ else
+ result = "openvzve"
+ end
end
if FileTest.exists?("/proc/xen/capabilities") && FileTest.readable?("/proc/xen/capabilities")