Skip to content

Commit

Permalink
Update docker.rb for Podman
Browse files Browse the repository at this point in the history
This if statement will enable the fact to work if you are using podman with docker symlink/support as the json syntax is lowercase on podman but camel/title case on docker.

As per - puppetlabs#982
  • Loading branch information
adamboutcher authored Sep 4, 2024
1 parent 63e09a1 commit f43a11a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/facter/docker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,11 @@ def interfaces
docker_network_names.each do |network|
inspect = JSON.parse(Facter::Core::Execution.execute("#{docker_command} network inspect #{network}", timeout: 90))
docker['network'][network] = inspect[0]
network_id = docker['network'][network]['Id'][0..11]
if docker['network'][network]['Id'].nil?
network_id = docker['network'][network]['id'][0..11]
else
network_id = docker['network'][network]['Id'][0..11]
end
interfaces.each do |iface|
docker['network']['managed_interfaces'][iface] = network if %r{#{network_id}}.match?(iface)
end
Expand Down

0 comments on commit f43a11a

Please sign in to comment.