Skip to content

Commit

Permalink
Merge pull request #2772 from smokris/container-illumos-lx-zone
Browse files Browse the repository at this point in the history
Fix `virtual` resolution on Illumos LX
  • Loading branch information
mhashizume authored Nov 1, 2024
2 parents 75a20f3 + 31d32da commit e0f379e
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 @@ -51,6 +51,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 @@ -92,6 +92,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 e0f379e

Please sign in to comment.