summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/facter/virtual.rb3
-rw-r--r--spec/unit/virtual.rb6
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/facter/virtual.rb b/lib/facter/virtual.rb
index a3b7163..8412a0a 100644
--- a/lib/facter/virtual.rb
+++ b/lib/facter/virtual.rb
@@ -106,8 +106,7 @@ Facter.add("is_virtual") do
confine :kernel => %w{Linux FreeBSD OpenBSD SunOS HP-UX Darwin}
setcode do
- case Facter.value(:virtual)
- when "xenu", "openvzve", "vmware", "kvm", "vserver", "jail", "zone", "hpvm", "parallels"
+ if Facter.value(:virtual) != "physical" && Facter.value(:virtual) != "xen0"
"true"
else
"false"
diff --git a/spec/unit/virtual.rb b/spec/unit/virtual.rb
index d607960..9e8e358 100644
--- a/spec/unit/virtual.rb
+++ b/spec/unit/virtual.rb
@@ -135,6 +135,12 @@ describe "is_virtual fact" do
Facter.fact(:is_virtual).value.should == "false"
end
+ it "should be false when running on physical" do
+ Facter.fact(:kernel).stubs(:value).returns("Linux")
+ Facter.fact(:virtual).stubs(:value).returns("physical")
+ Facter.fact(:is_virtual).value.should == "false"
+ end
+
it "should be true when running on vmware" do
Facter.fact(:kernel).stubs(:value).returns("Linux")
Facter.fact(:virtual).stubs(:value).returns("vmware")