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 and malikparvez committed Nov 27, 2024
1 parent 5a0775b commit f755321
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 f755321

Please sign in to comment.