diff --git a/changelogs/fragments/52010-handle-empty-output-in-remote_exists.yaml b/changelogs/fragments/52010-handle-empty-output-in-remote_exists.yaml new file mode 100644 index 0000000000..82dde3bfc5 --- /dev/null +++ b/changelogs/fragments/52010-handle-empty-output-in-remote_exists.yaml @@ -0,0 +1,2 @@ +bugfixes: + - flatpak_remote - Handle empty output in remote_exists, fixes https://github.com/ansible/ansible/issues/51481 diff --git a/lib/ansible/modules/packaging/os/flatpak_remote.py b/lib/ansible/modules/packaging/os/flatpak_remote.py index 508af3c927..64a632a98e 100644 --- a/lib/ansible/modules/packaging/os/flatpak_remote.py +++ b/lib/ansible/modules/packaging/os/flatpak_remote.py @@ -169,6 +169,8 @@ def remote_exists(module, binary, name, method): output = _flatpak_command(module, False, command) for line in output.splitlines(): listed_remote = line.split() + if len(listed_remote) == 0: + continue if listed_remote[0] == to_native(name): return True return False