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

Fix volume inspection by name in podman_volume (#684)

Fix #661
Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
This commit is contained in:
Sergey 2023-12-03 20:54:52 +02:00 committed by GitHub
parent edcb13dd8a
commit e245e332f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -327,7 +327,13 @@ class PodmanVolume:
# pylint: disable=unused-variable
rc, out, err = self.module.run_command(
[self.module.params['executable'], b'volume', b'inspect', self.name])
return json.loads(out)[0] if rc == 0 else {}
if rc == 0:
data = json.loads(out)
if data:
data = data[0]
if data.get("Name") == self.name:
return data
return {}
def _get_podman_version(self):
# pylint: disable=unused-variable