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 (#732)

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 14:24:13 +01:00 committed by GitHub
parent 7df5126cb3
commit 4591a44ef8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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: