mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-02-04 07:51:50 +00:00
replace batch of redundant to_native()/to_text() occurrences (#11104)
* replace batch of redundant to_native()/to_text() occurrences * add changelog frag
This commit is contained in:
parent
e5ee3eb88b
commit
4171b8a9ab
6 changed files with 12 additions and 9 deletions
|
|
@ -219,7 +219,6 @@ import os
|
|||
import math
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
|
||||
# These are the multiplicative suffixes understood (or returned) by dd and
|
||||
|
|
@ -453,7 +452,7 @@ def main():
|
|||
initial_filesize = current_size(args)
|
||||
size_descriptors = size_spec(args)
|
||||
except AssertionError as err:
|
||||
module.fail_json(msg=to_native(err))
|
||||
module.fail_json(msg=f"{err}")
|
||||
|
||||
expected_filesize = size_descriptors["bytes"]
|
||||
if initial_filesize:
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@ RETURN = r"""
|
|||
"""
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.common.text.converters import to_text
|
||||
|
||||
|
||||
class Namespace:
|
||||
|
|
@ -68,7 +67,7 @@ class Namespace:
|
|||
"""Check if the namespace already exists"""
|
||||
rc, out, err = self.module.run_command(["ip", "netns", "list"])
|
||||
if rc != 0:
|
||||
self.module.fail_json(msg=to_text(err))
|
||||
self.module.fail_json(msg=f"{err}")
|
||||
return self.name in out
|
||||
|
||||
def add(self):
|
||||
|
|
|
|||
|
|
@ -79,7 +79,6 @@ subca:
|
|||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.community.general.plugins.module_utils.ipa import IPAClient, ipa_argument_spec
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
|
|
@ -215,7 +214,7 @@ def main():
|
|||
changed, record = ensure(module, client)
|
||||
module.exit_json(changed=changed, record=record)
|
||||
except Exception as exc:
|
||||
module.fail_json(msg=to_native(exc))
|
||||
module.fail_json(msg=f"{exc}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
|
|
@ -841,7 +841,7 @@ class JIRA(StateModuleHelper):
|
|||
msg.append(to_native(error[key]))
|
||||
if msg:
|
||||
self.module.fail_json(msg=", ".join(msg))
|
||||
self.module.fail_json(msg=to_native(error))
|
||||
self.module.fail_json(msg=f"{error}")
|
||||
# Fallback print body, if it can't be decoded
|
||||
self.module.fail_json(msg=to_native(info["body"]))
|
||||
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ import base64
|
|||
import traceback
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||
from ansible.module_utils.common.text.converters import to_bytes, to_native, to_text
|
||||
from ansible.module_utils.common.text.converters import to_bytes, to_text
|
||||
from ansible_collections.community.general.plugins.module_utils.ldap import (
|
||||
LdapGeneric,
|
||||
gen_specs,
|
||||
|
|
@ -145,7 +145,7 @@ def main():
|
|||
try:
|
||||
LdapSearch(module).main()
|
||||
except Exception as exception:
|
||||
module.fail_json(msg="Attribute action failed.", details=to_native(exception))
|
||||
module.fail_json(msg="Attribute action failed.", details=f"{exception}")
|
||||
|
||||
|
||||
def _normalize_string(val, convert_to_base64):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue