summaryrefslogtreecommitdiffstats
path: root/lib/facter/util/virtual.rb
diff options
context:
space:
mode:
authorStefan Schulte <stefan.schulte@taunusstein.net>2010-11-03 21:55:58 +0100
committerStefan Schulte <stefan.schulte@taunusstein.net>2010-11-03 23:50:10 +0100
commit43e203c688399ac86d337514aecb6fa0c9def683 (patch)
treeb8e45f29cfc15264ac2a2d50a38575cdabb9dea8 /lib/facter/util/virtual.rb
parent889e1504c101b36741141ef95cf5cbdfedd95e56 (diff)
downloadfacter-43e203c688399ac86d337514aecb6fa0c9def683.tar.gz
facter-43e203c688399ac86d337514aecb6fa0c9def683.tar.xz
facter-43e203c688399ac86d337514aecb6fa0c9def683.zip
(#5040) fact virtual should detect hpvm
With HP-UX you can build virtual machines that are often refered to as HP-VMs. This patch detecs HP-VMs by introducing a new function hpvm? that will check the output of /usr/bin/getconf MACHINE_MODEL. This should not depend on any tools that might be not installed. If inside a HP-VM the command will say something like ia64 hp server Integrity Virtual Machine while on real hardware the output could be ia64 hp server rx660 so searching for "Virtual Machine" should work. Currently it only works if the guest is also running HP-UX. (I guess this is the most common usecase).
Diffstat (limited to 'lib/facter/util/virtual.rb')
-rw-r--r--lib/facter/util/virtual.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/facter/util/virtual.rb b/lib/facter/util/virtual.rb
index 5f70d42..5a03117 100644
--- a/lib/facter/util/virtual.rb
+++ b/lib/facter/util/virtual.rb
@@ -62,4 +62,8 @@ module Facter::Util::Virtual
Facter::Util::Resolution.exec("/sbin/sysctl -n security.jail.jailed") == "1"
end
+ def self.hpvm?
+ Facter::Util::Resolution.exec("/usr/bin/getconf MACHINE_MODEL").chomp =~ /Virtual Machine/
+ end
+
end