Skip to content

Commit 6bace22

Browse files
committed
(FACT-3484) Add lxc-libvirt to container resolver detection
1 parent eca23ba commit 6bace22

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

lib/facter/resolvers/containers.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ def read_environ(fact_name)
4545
case container
4646
when 'lxc'
4747
vm = 'lxc'
48+
when 'lxc-virtwhat'
49+
vm = 'lxc-virtwhat'
4850
when 'podman'
4951
vm = 'podman'
5052
when 'crio'

spec/facter/resolvers/containers_spec.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,20 @@
7878
end
7979
end
8080

81+
context 'when hypervisor is lxc-virtwhat and it is discovered by environ' do
82+
let(:cgroup_output) { load_fixture('cgroup_file').read }
83+
let(:environ_output) { ['container=lxc-virtwhat'] }
84+
let(:result) { { 'lxc-virtwhat': {} } }
85+
86+
it 'return lxc-virtwhat for vm' do
87+
expect(containers_resolver.resolve(:vm)).to eq('lxc-virtwhat')
88+
end
89+
90+
it 'return lxc-virtwhat info for hypervisor' do
91+
expect(containers_resolver.resolve(:hypervisor)).to eq(result)
92+
end
93+
end
94+
8195
context 'when hypervisor is neighter lxc nor docker' do
8296
let(:cgroup_output) { load_fixture('cgroup_file').read }
8397
let(:environ_output) { ['PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin'] }

0 commit comments

Comments
 (0)