From 711944aa9794a932c15492fc917e407b61188d4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Wirtel?= Date: Thu, 30 Aug 2018 22:36:34 +0200 Subject: [PATCH] Fix a comparison with a string and a byte in flatpak_remote (#44835) * flatpak_remote: Fix the comparison between string and bytes for the remote_exists function * Use to_text instead a new compare function * Compare bytes to bytes --- lib/ansible/modules/packaging/os/flatpak_remote.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/packaging/os/flatpak_remote.py b/lib/ansible/modules/packaging/os/flatpak_remote.py index 07b7ec86bb..8425e1b219 100644 --- a/lib/ansible/modules/packaging/os/flatpak_remote.py +++ b/lib/ansible/modules/packaging/os/flatpak_remote.py @@ -205,9 +205,11 @@ def main(): if not binary: module.fail_json(msg="Executable '%s' was not found on the system." % executable, **result) - if state == 'present' and not remote_exists(module, binary, name, method): + remote_already_exists = remote_exists(module, binary, bytes(name, 'utf-8'), method) + + if state == 'present' and not remote_already_exists: add_remote(module, binary, name, flatpakrepo_url, method) - elif state == 'absent' and remote_exists(module, binary, name, method): + elif state == 'absent' and remote_already_exists: remove_remote(module, binary, name, method) module.exit_json(**result)