[Pkg-puppet-devel] [facter] 21/352: (#21604) Detect xen virtual fact on windows

Stig Sandbeck Mathisen ssm at debian.org
Sun Apr 6 22:21:27 UTC 2014


This is an automated email from the git hooks/post-receive script.

ssm pushed a commit to branch master
in repository facter.

commit 87f345cc46cd39186b1cb2b36f4c93e7a8674529
Author: Lorenzo J. Cubero <lj.cubero at gmail.com>
Date:   Thu Jul 18 17:41:56 2013 +0200

    (#21604) Detect xen virtual fact on windows
---
 lib/facter/virtual.rb     | 7 ++++++-
 spec/unit/virtual_spec.rb | 6 ++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/lib/facter/virtual.rb b/lib/facter/virtual.rb
index c65a4bd..74eec5d 100644
--- a/lib/facter/virtual.rb
+++ b/lib/facter/virtual.rb
@@ -170,7 +170,12 @@ Facter.add("virtual") do
             computersystem.manufacturer =~ /Microsoft/ ? "hyperv" : nil
           when /VMware/ then "vmware"
           when /KVM/ then "kvm"
-          else "physical"
+          else
+            if computersystem.manufacturer =~ /Xen/
+              "xen"
+            else
+              "physical"
+            end
           end
         break
       end
diff --git a/spec/unit/virtual_spec.rb b/spec/unit/virtual_spec.rb
index 6215e30..88e3424 100755
--- a/spec/unit/virtual_spec.rb
+++ b/spec/unit/virtual_spec.rb
@@ -304,6 +304,12 @@ describe "Virtual fact" do
       Facter::Util::WMI.expects(:execquery).returns([computersystem])
       Facter.fact(:virtual).value.should == "vmware"
     end
+
+    it "resolves as Xen with a manufacturer name like xen" do
+      computersystem = mock('computersystem', :model => nil, :manufacturer => 'Xen')
+      Facter::Util::WMI.expects(:execquery).returns([computersystem])
+      Facter.fact(:virtual).value.should == "xen"
+    end
   end
 
   describe "with the virt-what command available (#8210)" do

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-puppet/facter.git



More information about the Pkg-puppet-devel mailing list