diff --git a/lib/facter/resolvers/containers.rb b/lib/facter/resolvers/containers.rb index 912a433fb3..ac02b321df 100644 --- a/lib/facter/resolvers/containers.rb +++ b/lib/facter/resolvers/containers.rb @@ -45,6 +45,8 @@ def read_environ(fact_name) case container when 'lxc' vm = 'lxc' + when 'lxc-virtwhat' + vm = 'lxc-virtwhat' when 'podman' vm = 'podman' when 'crio' diff --git a/spec/facter/resolvers/containers_spec.rb b/spec/facter/resolvers/containers_spec.rb index f74d94f40a..87b567d434 100644 --- a/spec/facter/resolvers/containers_spec.rb +++ b/spec/facter/resolvers/containers_spec.rb @@ -78,6 +78,20 @@ end end + context 'when hypervisor is lxc-virtwhat and it is discovered by environ' do + let(:cgroup_output) { load_fixture('cgroup_file').read } + let(:environ_output) { ['container=lxc-virtwhat'] } + let(:result) { { 'lxc-virtwhat': {} } } + + it 'return lxc-virtwhat for vm' do + expect(containers_resolver.resolve(:vm)).to eq('lxc-virtwhat') + end + + it 'return lxc-virtwhat info for hypervisor' do + expect(containers_resolver.resolve(:hypervisor)).to eq(result) + end + end + context 'when hypervisor is neighter lxc nor docker' do let(:cgroup_output) { load_fixture('cgroup_file').read } let(:environ_output) { ['PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin'] }