summaryrefslogtreecommitdiffstats
path: root/lib/facter/util
diff options
context:
space:
mode:
authorPaul Nasrat <pnasrat@googlemail.com>2009-09-05 06:45:50 +0100
committerPaul Nasrat <pnasrat@googlemail.com>2009-09-09 07:04:44 +0100
commit49470cf776f2c23cabec00b68b85a1264a3f7b48 (patch)
treebd1dd2d50d79836569451658a12cee4c89dc199a /lib/facter/util
parent9515a403b2a3350b3b6eb2c1578c5871e9588ac2 (diff)
downloadfacter-49470cf776f2c23cabec00b68b85a1264a3f7b48.tar.gz
facter-49470cf776f2c23cabec00b68b85a1264a3f7b48.tar.xz
facter-49470cf776f2c23cabec00b68b85a1264a3f7b48.zip
Fix broken solaris zone tests on EC2
This cleans up xen and vserver detection to enable us to stub out so when we happen to be running tests on xen we don't report as that. More cleanup is needed in this area but this should give us a green build. This renames the tests to be consistent with current naming convention
Diffstat (limited to 'lib/facter/util')
-rw-r--r--lib/facter/util/virtual.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/facter/util/virtual.rb b/lib/facter/util/virtual.rb
index 8db57a3..0c3fb73 100644
--- a/lib/facter/util/virtual.rb
+++ b/lib/facter/util/virtual.rb
@@ -24,4 +24,20 @@ module Facter::Util::Virtual
return true if txt =~ /^(s_context|VxID):[[:blank:]]*[1-9]/
return false
end
+
+ def self.vserver_type
+ if self.vserver?
+ if FileTest.exists?("/proc/virtual")
+ "vserver_host"
+ else
+ "vserver"
+ end
+ end
+ end
+
+ def self.xen?
+ ["/proc/sys/xen", "/sys/bus/xen", "/proc/xen" ].detect do |f|
+ FileTest.exists?(f)
+ end
+ end
end