Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading