[Pkg-puppet-devel] [facter] 22/352: (maint) Refactor windows virtual fact for readability
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 1bc12b9eec460c9835ccf3fcb26942702b4e7b49
Author: Adrien Thebo <git at somethingsinistral.net>
Date: Mon Sep 9 09:44:28 2013 -0700
(maint) Refactor windows virtual fact for readability
---
lib/facter/virtual.rb | 31 +++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/lib/facter/virtual.rb b/lib/facter/virtual.rb
index 74eec5d..98f8f25 100644
--- a/lib/facter/virtual.rb
+++ b/lib/facter/virtual.rb
@@ -163,22 +163,25 @@ Facter.add("virtual") do
require 'facter/util/wmi'
result = nil
Facter::Util::WMI.execquery("SELECT manufacturer, model FROM Win32_ComputerSystem").each do |computersystem|
- result =
- case computersystem.model
- when /VirtualBox/ then "virtualbox"
- when /Virtual Machine/
- computersystem.manufacturer =~ /Microsoft/ ? "hyperv" : nil
- when /VMware/ then "vmware"
- when /KVM/ then "kvm"
- else
- if computersystem.manufacturer =~ /Xen/
- "xen"
- else
- "physical"
- end
- end
+ case computersystem.model
+ when /VirtualBox/
+ result = "virtualbox"
+ when /Virtual Machine/
+ result = "hyperv" if computersystem.manufacturer =~ /Microsoft/
+ when /VMware/
+ result = "vmware"
+ when /KVM/
+ result = "kvm"
+ end
+
+ if result.nil? and computersystem.manufacturer =~ /Xen/
+ result = "xen"
+ end
+
break
end
+ result ||= "physical"
+
result
end
end
--
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