Skip to content

Commit 859d888

Browse files
authored
Merge pull request #2692 from kenyon/windows-ahv
2 parents dbfb450 + 61b8df8 commit 859d888

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

lib/facter/resolvers/windows/virtualization.rb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,15 @@ class << self
1212
# Virtual
1313
# Is_Virtual
1414

15-
MODEL_HASH = { 'VirtualBox' => 'virtualbox', 'VMware' => 'vmware', 'KVM' => 'kvm',
16-
'Bochs' => 'bochs', 'Google' => 'gce', 'OpenStack' => 'openstack' }.freeze
15+
MODEL_HASH = {
16+
'VirtualBox' => 'virtualbox',
17+
'VMware' => 'vmware',
18+
'KVM' => 'kvm',
19+
'Bochs' => 'bochs',
20+
'Google' => 'gce',
21+
'OpenStack' => 'openstack',
22+
'AHV' => 'ahv'
23+
}.freeze
1724

1825
private
1926

spec/facter/resolvers/windows/virtualization_spec.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,26 @@
103103
end
104104
end
105105

106+
describe '#resolve AHV VM' do
107+
before do
108+
allow(win32ole).to receive(:Model).and_return(model)
109+
allow(win32ole).to receive(:Manufacturer).and_return(manufacturer)
110+
allow(win32ole).to receive(:OEMStringArray).and_return('')
111+
end
112+
113+
let(:query_result) { [win32ole] }
114+
let(:model) { 'AHV' }
115+
let(:manufacturer) {}
116+
117+
it 'detects virtual machine model' do
118+
expect(Facter::Resolvers::Windows::Virtualization.resolve(:virtual)).to eql('ahv')
119+
end
120+
121+
it 'detects that is virtual' do
122+
expect(Facter::Resolvers::Windows::Virtualization.resolve(:is_virtual)).to be(true)
123+
end
124+
end
125+
106126
describe '#resolve Microsoft VM' do
107127
before do
108128
allow(win32ole).to receive(:Model).and_return(model)

0 commit comments

Comments
 (0)