1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-04-06 20:17:15 +00:00

[PR #11106/f785e9c7 backport][stable-12] replace batch of redundant to_native()/to_text() occurrences (#11140)

replace batch of redundant to_native()/to_text() occurrences (#11106)

* replace batch of redundant to_native()/to_text() occurrences

* add changelog frag

* snap sanity

* rolling back snap for now

* more cases in redhat_subscription

(cherry picked from commit f785e9c780)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2025-11-12 21:59:09 +01:00 committed by GitHub
parent 4b9ece4fbd
commit 619ea5b7b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 47 additions and 45 deletions

View file

@ -113,7 +113,6 @@ command:
"""
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.common.text.converters import to_bytes, to_native
def add_remote(module, binary, name, flatpakrepo_url, method):
@ -141,7 +140,7 @@ def remote_exists(module, binary, name, method):
listed_remote = line.split()
if len(listed_remote) == 0:
continue
if listed_remote[0] == to_native(name):
if listed_remote[0] == name:
return True
return False
@ -171,7 +170,7 @@ def remote_enabled(module, binary, name, method):
listed_remote = line.split()
if len(listed_remote) == 0:
continue
if listed_remote[0] == to_native(name):
if listed_remote[0] == name:
return len(listed_remote) == 1 or "disabled" not in listed_remote[1].split(",")
return False
@ -219,7 +218,7 @@ def main():
if not binary:
module.fail_json(msg=f"Executable '{executable}' was not found on the system.", **result)
remote_already_exists = remote_exists(module, binary, to_bytes(name), method)
remote_already_exists = remote_exists(module, binary, name, method)
if state == "present" and not remote_already_exists:
add_remote(module, binary, name, flatpakrepo_url, method)
@ -227,7 +226,7 @@ def main():
remove_remote(module, binary, name, method)
if state == "present":
remote_already_enabled = remote_enabled(module, binary, to_bytes(name), method)
remote_already_enabled = remote_enabled(module, binary, name, method)
if enabled and not remote_already_enabled:
enable_remote(module, binary, name, method)