From f7553214c0b66595fb9a888fae6956383a26174b Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 4 Sep 2024 21:32:14 +0100 Subject: [PATCH] Update docker.rb for Podman 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 - https://github.com/puppetlabs/puppetlabs-docker/issues/982 --- lib/facter/docker.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/facter/docker.rb b/lib/facter/docker.rb index 368c12e6..8624d5d8 100644 --- a/lib/facter/docker.rb +++ b/lib/facter/docker.rb @@ -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