1
0
Fork 0
mirror of https://github.com/containers/ansible-podman-collections.git synced 2026-02-04 07:11:49 +00:00

Fix pod info for non-existant pods

Do not try to deserialize json when out is empty

Fixes #731

Signed-off-by: Oliver Walsh <owalsh@redhat.com>
This commit is contained in:
Oliver Walsh 2024-04-12 11:47:56 +01:00
parent 7df5126cb3
commit f2af066b21

View file

@ -109,7 +109,7 @@ def get_pod_info(module, executable, name):
rc, out, err = module.run_command(command + [pod])
errs.append(err.strip())
rcs += [rc]
data = json.loads(out)
data = json.loads(out) if out else None
if isinstance(data, list) and data:
data = data[0]
if not out or data is None or not data: