Skip to content

Commit

Permalink
On Illumos LX, make Facter::Resolvers::Containers return nil, so Fact…
Browse files Browse the repository at this point in the history
…er::Util::Facts::Posix::VirtualDetector#check_illumos_lx is executed
  • Loading branch information
smokris committed Oct 20, 2024
1 parent eca23ba commit a9b13e9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/facter/resolvers/containers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ def read_environ(fact_name)
vm = 'podman'
when 'crio'
vm = 'crio'
when 'zone'
return nil
when 'systemd-nspawn'
vm = 'systemd_nspawn'
info = { 'id' => Facter::Util::FileHelper.safe_read('/etc/machine-id', nil).strip }
Expand Down
10 changes: 10 additions & 0 deletions spec/facter/resolvers/containers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,16 @@
end
end

context 'when hypervisor is illumos' do
let(:cgroup_output) { nil }
let(:environ_output) { ['container=zone'] }

it 'return nil' do
expect(containers_resolver.resolve(:vm)).to eq(nil)
expect(containers_resolver.resolve(:hypervisor)).to eq(nil)
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'] }
Expand Down

0 comments on commit a9b13e9

Please sign in to comment.