diff --git a/changelogs/fragments/11098-tonative-1.yml b/changelogs/fragments/11098-tonative-1.yml new file mode 100644 index 0000000000..8dfc52c305 --- /dev/null +++ b/changelogs/fragments/11098-tonative-1.yml @@ -0,0 +1,64 @@ +minor_changes: + + - atomic_host - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - atomic_image - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - bigpanda - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - datadog_event - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - datadog_monitor - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - hpilo_info - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - htpasswd - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - idrac_redfish_config - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - influxdb_query - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - influxdb_user - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - influxdb_write - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - ipa_config - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - ipa_dnsrecord - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - ipa_dnszone - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - ipa_group - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - ipa_hbacrule - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - ipa_host - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - ipa_hostgroup - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - ipa_otpconfig - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - ipa_otptoken - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - ipa_pwpolicy - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - ipa_role - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - ipa_service - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - ipa_sudocmd - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - ipa_sudocmdgroup - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - ipa_sudorule - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - ipa_user - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - ipa_vault - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - listen_ports_facts - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - modprobe - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - nomad_job - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - nomad_job_info - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - nomad_token - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - pids - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - pritunl_org - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - pritunl_org_info - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - pritunl_user - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - pritunl_user_info - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - read_csv - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - selinux_permissive - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - sensu_check - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - sensu_subscription - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - sudoers - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - utm_aaa_group - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - utm_aaa_group_info - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - utm_ca_host_key_cert - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - utm_ca_host_key_cert_info - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - utm_dns_host - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - utm_network_interface_address - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - utm_network_interface_address_info - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - utm_proxy_auth_profile - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - utm_proxy_exception - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - utm_proxy_frontend - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - utm_proxy_frontend_info - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - utm_proxy_location - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - utm_proxy_location_info - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - vertica_configuration - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - vertica_info - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - vertica_role - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - vertica_schema - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - vertica_user - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). + - wakeonlan - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/11098). diff --git a/plugins/modules/atomic_host.py b/plugins/modules/atomic_host.py index eabdc80de7..f0e78ef379 100644 --- a/plugins/modules/atomic_host.py +++ b/plugins/modules/atomic_host.py @@ -61,7 +61,6 @@ import os import traceback from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.common.text.converters import to_native def core(module): @@ -99,7 +98,7 @@ def main(): try: core(module) except Exception as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) if __name__ == "__main__": diff --git a/plugins/modules/atomic_image.py b/plugins/modules/atomic_image.py index 8b31d1eae9..a09e48144f 100644 --- a/plugins/modules/atomic_image.py +++ b/plugins/modules/atomic_image.py @@ -78,7 +78,6 @@ msg: import traceback from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.common.text.converters import to_native def do_upgrade(module, image): @@ -171,7 +170,7 @@ def main(): try: core(module) except Exception as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) if __name__ == "__main__": diff --git a/plugins/modules/bigpanda.py b/plugins/modules/bigpanda.py index 67091fcd74..9fdf7cca24 100644 --- a/plugins/modules/bigpanda.py +++ b/plugins/modules/bigpanda.py @@ -130,7 +130,6 @@ import socket import traceback from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.common.text.converters import to_native from ansible.module_utils.urls import fetch_url @@ -210,7 +209,7 @@ def main(): else: module.fail_json(msg=json.dumps(info)) except Exception as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) if __name__ == "__main__": diff --git a/plugins/modules/datadog_event.py b/plugins/modules/datadog_event.py index 5b71d32d31..6c4346bf5b 100644 --- a/plugins/modules/datadog_event.py +++ b/plugins/modules/datadog_event.py @@ -137,7 +137,6 @@ except Exception: HAS_DATADOG = False from ansible.module_utils.basic import AnsibleModule, missing_required_lib -from ansible.module_utils.common.text.converters import to_native def main(): @@ -193,7 +192,7 @@ def _post_event(module): module.exit_json(changed=True, msg=msg) except Exception as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) if __name__ == "__main__": diff --git a/plugins/modules/datadog_monitor.py b/plugins/modules/datadog_monitor.py index 21ecfee5d5..efc5d9adf6 100644 --- a/plugins/modules/datadog_monitor.py +++ b/plugins/modules/datadog_monitor.py @@ -250,7 +250,6 @@ except Exception: HAS_DATADOG = False from ansible.module_utils.basic import AnsibleModule, missing_required_lib -from ansible.module_utils.common.text.converters import to_native def main(): @@ -370,7 +369,7 @@ def _post_monitor(module, options): else: module.exit_json(changed=True, msg=msg) except Exception as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) def _equal_dicts(a, b, ignore_keys): @@ -403,7 +402,7 @@ def _update_monitor(module, monitor, options): else: module.exit_json(changed=True, msg=msg) except Exception as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) def install_monitor(module): @@ -448,7 +447,7 @@ def delete_monitor(module): msg = api.Monitor.delete(monitor["id"]) module.exit_json(changed=True, msg=msg) except Exception as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) def mute_monitor(module): @@ -471,7 +470,7 @@ def mute_monitor(module): msg = api.Monitor.mute(id=monitor["id"], silenced=module.params["silenced"]) module.exit_json(changed=True, msg=msg) except Exception as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) def unmute_monitor(module): @@ -484,7 +483,7 @@ def unmute_monitor(module): msg = api.Monitor.unmute(monitor["id"]) module.exit_json(changed=True, msg=msg) except Exception as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) if __name__ == "__main__": diff --git a/plugins/modules/hpilo_info.py b/plugins/modules/hpilo_info.py index 20ec59bbd5..e3d1132327 100644 --- a/plugins/modules/hpilo_info.py +++ b/plugins/modules/hpilo_info.py @@ -140,7 +140,6 @@ except ImportError: HAS_HPILO = False from ansible.module_utils.basic import AnsibleModule, missing_required_lib -from ansible.module_utils.common.text.converters import to_native # Suppress warnings from hpilo @@ -187,7 +186,7 @@ def main(): data = ilo.get_host_data() power_state = ilo.get_host_power_status() except hpilo.IloCommunicationError as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") for entry in data: if "type" not in entry: diff --git a/plugins/modules/htpasswd.py b/plugins/modules/htpasswd.py index 5be2244e8a..9a7c8102f7 100644 --- a/plugins/modules/htpasswd.py +++ b/plugins/modules/htpasswd.py @@ -104,7 +104,6 @@ import tempfile from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.general.plugins.module_utils import deps -from ansible.module_utils.common.text.converters import to_native with deps.declare("passlib"): @@ -242,7 +241,7 @@ def main(): (msg, changed) = check_file_attrs(module, changed, msg) module.exit_json(msg=msg, changed=changed) except Exception as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") if __name__ == "__main__": diff --git a/plugins/modules/idrac_redfish_config.py b/plugins/modules/idrac_redfish_config.py index 038ff8b0e1..ec21cec3fa 100644 --- a/plugins/modules/idrac_redfish_config.py +++ b/plugins/modules/idrac_redfish_config.py @@ -311,7 +311,7 @@ def main(): check_mutually_exclusive(CATEGORY_COMMANDS_MUTUALLY_EXCLUSIVE[category], dict.fromkeys(command_list, True)) except TypeError as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") # Organize by Categories / Commands diff --git a/plugins/modules/influxdb_query.py b/plugins/modules/influxdb_query.py index 6ea1f6d94a..85c8ea8f06 100644 --- a/plugins/modules/influxdb_query.py +++ b/plugins/modules/influxdb_query.py @@ -66,7 +66,6 @@ query_results: """ from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.common.text.converters import to_native from ansible_collections.community.general.plugins.module_utils.influxdb import InfluxDb @@ -78,7 +77,7 @@ class AnsibleInfluxDBRead(InfluxDb): if rs: return list(rs.get_points()) except Exception as e: - self.module.fail_json(msg=to_native(e)) + self.module.fail_json(msg=f"{e}") def main(): diff --git a/plugins/modules/influxdb_user.py b/plugins/modules/influxdb_user.py index 2e4339acf3..2bee172f09 100644 --- a/plugins/modules/influxdb_user.py +++ b/plugins/modules/influxdb_user.py @@ -104,7 +104,6 @@ import json from ansible.module_utils.urls import ConnectionError from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.common.text.converters import to_native import ansible_collections.community.general.plugins.module_utils.influxdb as influx @@ -118,7 +117,7 @@ def find_user(module, client, user_name): user_result = user break except ConnectionError as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") return user_result @@ -130,7 +129,7 @@ def check_user_password(module, client, user_name, user_password): if e.code == 401: return False except ConnectionError as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") finally: # restore previous user client.switch_user(module.params["username"], module.params["password"]) @@ -142,7 +141,7 @@ def set_user_password(module, client, user_name, user_password): try: client.set_user_password(user_name, user_password) except ConnectionError as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") def create_user(module, client, user_name, user_password, admin): @@ -150,7 +149,7 @@ def create_user(module, client, user_name, user_password, admin): try: client.create_user(user_name, user_password, admin) except ConnectionError as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") def drop_user(module, client, user_name): @@ -234,12 +233,12 @@ def main(): msg = json.loads(e.content) reason = msg["error"] except (KeyError, ValueError): - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") if reason != INFLUX_AUTH_FIRST_USER_REQUIRED: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") else: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") changed = False @@ -259,7 +258,7 @@ def main(): client.revoke_admin_privileges(user_name) changed = True except influx.exceptions.InfluxDBClientError as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") else: user_password = user_password or "" diff --git a/plugins/modules/influxdb_write.py b/plugins/modules/influxdb_write.py index 9d1d3ab9d8..e54716c209 100644 --- a/plugins/modules/influxdb_write.py +++ b/plugins/modules/influxdb_write.py @@ -63,7 +63,6 @@ RETURN = r""" """ from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.common.text.converters import to_native from ansible_collections.community.general.plugins.module_utils.influxdb import InfluxDb @@ -74,7 +73,7 @@ class AnsibleInfluxDBWrite(InfluxDb): try: client.write_points(data_points) except Exception as e: - self.module.fail_json(msg=to_native(e)) + self.module.fail_json(msg=f"{e}") def main(): diff --git a/plugins/modules/ipa_config.py b/plugins/modules/ipa_config.py index 2386a81ab2..0926ec8c36 100644 --- a/plugins/modules/ipa_config.py +++ b/plugins/modules/ipa_config.py @@ -231,7 +231,6 @@ import traceback 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 class ConfigIPAClient(IPAClient): @@ -391,7 +390,7 @@ def main(): changed, user = ensure(module, client) module.exit_json(changed=changed, user=user) except Exception as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) if __name__ == "__main__": diff --git a/plugins/modules/ipa_dnsrecord.py b/plugins/modules/ipa_dnsrecord.py index 16a94693e4..3b17d4027b 100644 --- a/plugins/modules/ipa_dnsrecord.py +++ b/plugins/modules/ipa_dnsrecord.py @@ -365,7 +365,7 @@ def main(): changed, record = ensure(module, client) module.exit_json(changed=changed, record=record) except Exception as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) if __name__ == "__main__": diff --git a/plugins/modules/ipa_dnszone.py b/plugins/modules/ipa_dnszone.py index fbf3fdfcf9..85eab4e4f4 100644 --- a/plugins/modules/ipa_dnszone.py +++ b/plugins/modules/ipa_dnszone.py @@ -85,7 +85,6 @@ zone: 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 class DNSZoneIPAClient(IPAClient): @@ -188,7 +187,7 @@ def main(): changed, zone = ensure(module, client) module.exit_json(changed=changed, zone=zone) except Exception as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") if __name__ == "__main__": diff --git a/plugins/modules/ipa_group.py b/plugins/modules/ipa_group.py index 7e92e10c8d..adcb3b569f 100644 --- a/plugins/modules/ipa_group.py +++ b/plugins/modules/ipa_group.py @@ -172,7 +172,6 @@ import traceback 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 class GroupIPAClient(IPAClient): @@ -358,7 +357,7 @@ def main(): changed, group = ensure(module, client) module.exit_json(changed=changed, group=group) except Exception as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) if __name__ == "__main__": diff --git a/plugins/modules/ipa_hbacrule.py b/plugins/modules/ipa_hbacrule.py index 2db08b7ed8..8111996519 100644 --- a/plugins/modules/ipa_hbacrule.py +++ b/plugins/modules/ipa_hbacrule.py @@ -156,7 +156,6 @@ import traceback 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 @@ -430,7 +429,7 @@ def main(): changed, hbacrule = ensure(module, client) module.exit_json(changed=changed, hbacrule=hbacrule) except Exception as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) if __name__ == "__main__": diff --git a/plugins/modules/ipa_host.py b/plugins/modules/ipa_host.py index 39e620d7fc..6cda72a196 100644 --- a/plugins/modules/ipa_host.py +++ b/plugins/modules/ipa_host.py @@ -185,7 +185,6 @@ import traceback 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 class HostIPAClient(IPAClient): @@ -351,7 +350,7 @@ def main(): changed, host = ensure(module, client) module.exit_json(changed=changed, host=host) except Exception as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) if __name__ == "__main__": diff --git a/plugins/modules/ipa_hostgroup.py b/plugins/modules/ipa_hostgroup.py index d957fbcfb3..47b8aa3947 100644 --- a/plugins/modules/ipa_hostgroup.py +++ b/plugins/modules/ipa_hostgroup.py @@ -99,7 +99,6 @@ import traceback 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 class HostGroupIPAClient(IPAClient): @@ -234,7 +233,7 @@ def main(): changed, hostgroup = ensure(module, client) module.exit_json(changed=changed, hostgroup=hostgroup) except Exception as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) if __name__ == "__main__": diff --git a/plugins/modules/ipa_otpconfig.py b/plugins/modules/ipa_otpconfig.py index 05e8b5009c..0601adc778 100644 --- a/plugins/modules/ipa_otpconfig.py +++ b/plugins/modules/ipa_otpconfig.py @@ -82,7 +82,6 @@ import traceback 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 class OTPConfigIPAClient(IPAClient): @@ -161,7 +160,7 @@ def main(): client.login(username=module.params["ipa_user"], password=module.params["ipa_pass"]) changed, otpconfig = ensure(module, client) except Exception as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) module.exit_json(changed=changed, otpconfig=otpconfig) diff --git a/plugins/modules/ipa_otptoken.py b/plugins/modules/ipa_otptoken.py index 4b77ac6295..443ad2750a 100644 --- a/plugins/modules/ipa_otptoken.py +++ b/plugins/modules/ipa_otptoken.py @@ -173,7 +173,6 @@ import traceback from ansible.module_utils.basic import AnsibleModule, sanitize_keys from ansible_collections.community.general.plugins.module_utils.ipa import IPAClient, ipa_argument_spec -from ansible.module_utils.common.text.converters import to_native class OTPTokenIPAClient(IPAClient): @@ -546,7 +545,7 @@ def main(): client.login(username=module.params["ipa_user"], password=module.params["ipa_pass"]) changed, otptoken = ensure(module, client) except Exception as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) module.exit_json(changed=changed, otptoken=otptoken) diff --git a/plugins/modules/ipa_pwpolicy.py b/plugins/modules/ipa_pwpolicy.py index 0be1413240..63166953d9 100644 --- a/plugins/modules/ipa_pwpolicy.py +++ b/plugins/modules/ipa_pwpolicy.py @@ -314,7 +314,7 @@ def main(): client.login(username=module.params["ipa_user"], password=module.params["ipa_pass"]) changed, pwpolicy = ensure(module, client) except Exception as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) module.exit_json(changed=changed, pwpolicy=pwpolicy) diff --git a/plugins/modules/ipa_role.py b/plugins/modules/ipa_role.py index 9038f89a1b..516a7fc93a 100644 --- a/plugins/modules/ipa_role.py +++ b/plugins/modules/ipa_role.py @@ -135,7 +135,6 @@ import traceback 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 class RoleIPAClient(IPAClient): @@ -331,7 +330,7 @@ def main(): changed, role = ensure(module, client) module.exit_json(changed=changed, role=role) except Exception as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) if __name__ == "__main__": diff --git a/plugins/modules/ipa_service.py b/plugins/modules/ipa_service.py index c1d95c0564..d53169b2fe 100644 --- a/plugins/modules/ipa_service.py +++ b/plugins/modules/ipa_service.py @@ -90,7 +90,6 @@ import traceback 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 class ServiceIPAClient(IPAClient): @@ -212,7 +211,7 @@ def main(): changed, host = ensure(module, client) module.exit_json(changed=changed, host=host) except Exception as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) if __name__ == "__main__": diff --git a/plugins/modules/ipa_sudocmd.py b/plugins/modules/ipa_sudocmd.py index deee41108f..2561a408c7 100644 --- a/plugins/modules/ipa_sudocmd.py +++ b/plugins/modules/ipa_sudocmd.py @@ -67,7 +67,6 @@ import traceback 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 class SudoCmdIPAClient(IPAClient): @@ -150,7 +149,7 @@ def main(): changed, sudocmd = ensure(module, client) module.exit_json(changed=changed, sudocmd=sudocmd) except Exception as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) if __name__ == "__main__": diff --git a/plugins/modules/ipa_sudocmdgroup.py b/plugins/modules/ipa_sudocmdgroup.py index 093c380e31..151500a66b 100644 --- a/plugins/modules/ipa_sudocmdgroup.py +++ b/plugins/modules/ipa_sudocmdgroup.py @@ -76,7 +76,6 @@ import traceback 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 class SudoCmdGroupIPAClient(IPAClient): @@ -182,7 +181,7 @@ def main(): changed, sudocmdgroup = ensure(module, client) module.exit_json(changed=changed, sudorule=sudocmdgroup) except Exception as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) if __name__ == "__main__": diff --git a/plugins/modules/ipa_sudorule.py b/plugins/modules/ipa_sudorule.py index 990ea147dd..dd0ec953f5 100644 --- a/plugins/modules/ipa_sudorule.py +++ b/plugins/modules/ipa_sudorule.py @@ -199,7 +199,6 @@ import traceback 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 @@ -553,7 +552,7 @@ def main(): changed, sudorule = ensure(module, client) module.exit_json(changed=changed, sudorule=sudorule) except Exception as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) if __name__ == "__main__": diff --git a/plugins/modules/ipa_user.py b/plugins/modules/ipa_user.py index 50dbe6d58b..d6cc21079b 100644 --- a/plugins/modules/ipa_user.py +++ b/plugins/modules/ipa_user.py @@ -183,7 +183,6 @@ import traceback 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 class UserIPAClient(IPAClient): @@ -422,7 +421,7 @@ def main(): changed, user = ensure(module, client) module.exit_json(changed=changed, user=user) except Exception as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) if __name__ == "__main__": diff --git a/plugins/modules/ipa_vault.py b/plugins/modules/ipa_vault.py index c9ec98d5e4..0cf9365bc8 100644 --- a/plugins/modules/ipa_vault.py +++ b/plugins/modules/ipa_vault.py @@ -138,7 +138,6 @@ import traceback 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 class VaultIPAClient(IPAClient): @@ -252,7 +251,7 @@ def main(): changed, vault = ensure(module, client) module.exit_json(changed=changed, vault=vault) except Exception as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) if __name__ == "__main__": diff --git a/plugins/modules/listen_ports_facts.py b/plugins/modules/listen_ports_facts.py index 00e263f48f..bff3933216 100644 --- a/plugins/modules/listen_ports_facts.py +++ b/plugins/modules/listen_ports_facts.py @@ -189,7 +189,6 @@ ansible_facts: import re import platform -from ansible.module_utils.common.text.converters import to_native from ansible.module_utils.basic import AnsibleModule @@ -418,7 +417,7 @@ def main(): elif connection["protocol"].startswith("udp"): result["ansible_facts"]["udp_listen"].append(connection) except (KeyError, EnvironmentError) as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") module.exit_json(**result) diff --git a/plugins/modules/modprobe.py b/plugins/modules/modprobe.py index cbdfb509dd..532ca5df90 100644 --- a/plugins/modules/modprobe.py +++ b/plugins/modules/modprobe.py @@ -86,7 +86,6 @@ import traceback import re from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.common.text.converters import to_native RELEASE_VER = platform.release() MODULES_LOAD_LOCATION = "/etc/modules-load.d" @@ -260,7 +259,7 @@ class Modprobe: is_loaded = True break except (IOError, OSError) as e: - self.module.fail_json(msg=to_native(e), exception=traceback.format_exc(), **self.result) + self.module.fail_json(msg=f"{e}", exception=traceback.format_exc(), **self.result) return is_loaded diff --git a/plugins/modules/nomad_job.py b/plugins/modules/nomad_job.py index 98a333fdf2..342d3d6a40 100644 --- a/plugins/modules/nomad_job.py +++ b/plugins/modules/nomad_job.py @@ -155,7 +155,7 @@ def run(): try: job_json = json.loads(job_json) except ValueError as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") job = dict() job["job"] = job_json try: @@ -172,7 +172,7 @@ def run(): else: result = plan except Exception as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") if module.params.get("content_format") == "hcl": try: @@ -195,7 +195,7 @@ def run(): else: result = plan except Exception as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") if module.params.get("force_start"): try: @@ -220,7 +220,7 @@ def run(): result = json.loads(result.text) changed = True except Exception as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") if module.params.get("state") == "absent": try: @@ -244,7 +244,7 @@ def run(): result = job changed = True except Exception as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") module.exit_json(changed=changed, result=result) diff --git a/plugins/modules/nomad_job_info.py b/plugins/modules/nomad_job_info.py index 5bc9cc9f79..a094e296a0 100644 --- a/plugins/modules/nomad_job_info.py +++ b/plugins/modules/nomad_job_info.py @@ -263,7 +263,6 @@ result: """ from ansible.module_utils.basic import AnsibleModule, missing_required_lib -from ansible.module_utils.common.text.converters import to_native import_nomad = None try: @@ -314,7 +313,7 @@ def run(): for job in job_list: result.append(nomad_client.job.get_job(job.get("ID"))) except Exception as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") if module.params.get("name"): filter = list() @@ -326,7 +325,7 @@ def run(): if not filter: module.fail_json(msg=f"Couldn't find Job with id {module.params['name']}") except Exception as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") module.exit_json(changed=changed, result=result) diff --git a/plugins/modules/nomad_token.py b/plugins/modules/nomad_token.py index 0c18d1e115..0c8da6ef4d 100644 --- a/plugins/modules/nomad_token.py +++ b/plugins/modules/nomad_token.py @@ -120,7 +120,6 @@ result: """ from ansible.module_utils.basic import AnsibleModule, missing_required_lib -from ansible.module_utils.common.text.converters import to_native import_nomad = None @@ -235,7 +234,7 @@ def run(module): changed = True except Exception as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") else: try: token_info = { @@ -261,7 +260,7 @@ def run(module): changed = True except Exception as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") if module.params.get("state") == "absent": if not module.params.get("name"): @@ -280,7 +279,7 @@ def run(module): msg = f"No token with name '{module.params['name']}' found" except Exception as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") module.exit_json(changed=changed, msg=msg, result=result) diff --git a/plugins/modules/pids.py b/plugins/modules/pids.py index fb8cce2d10..9dafeface8 100644 --- a/plugins/modules/pids.py +++ b/plugins/modules/pids.py @@ -199,7 +199,7 @@ class Pids: try: self._pids = self._ps.get_pids_by_pattern(self._pattern, self._ignore_case) except PSAdapterError as e: - self._module.fail_json(msg=to_native(e)) + self._module.fail_json(msg=f"{e}") return self._module.exit_json(**self.result) diff --git a/plugins/modules/pritunl_org.py b/plugins/modules/pritunl_org.py index bafc4026ab..e59539f902 100644 --- a/plugins/modules/pritunl_org.py +++ b/plugins/modules/pritunl_org.py @@ -77,7 +77,6 @@ response: from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.common.text.converters import to_native from ansible.module_utils.common.dict_transformations import dict_merge from ansible_collections.community.general.plugins.module_utils.net_tools.pritunl.api import ( PritunlException, @@ -188,7 +187,7 @@ def main(): elif state == "absent": remove_pritunl_organization(module) except PritunlException as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") if __name__ == "__main__": diff --git a/plugins/modules/pritunl_org_info.py b/plugins/modules/pritunl_org_info.py index b282e67f1c..dd867b88c2 100644 --- a/plugins/modules/pritunl_org_info.py +++ b/plugins/modules/pritunl_org_info.py @@ -72,7 +72,6 @@ organizations: """ from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.common.text.converters import to_native from ansible.module_utils.common.dict_transformations import dict_merge from ansible_collections.community.general.plugins.module_utils.net_tools.pritunl.api import ( PritunlException, @@ -115,7 +114,7 @@ def main(): try: get_pritunl_organizations(module) except PritunlException as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") if __name__ == "__main__": diff --git a/plugins/modules/pritunl_user.py b/plugins/modules/pritunl_user.py index 99a521e7ab..5e007f72fd 100644 --- a/plugins/modules/pritunl_user.py +++ b/plugins/modules/pritunl_user.py @@ -142,7 +142,6 @@ response: from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.common.text.converters import to_native from ansible.module_utils.common.dict_transformations import dict_merge from ansible_collections.community.general.plugins.module_utils.net_tools.pritunl.api import ( PritunlException, @@ -331,7 +330,7 @@ def main(): elif state == "absent": remove_pritunl_user(module) except PritunlException as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") if __name__ == "__main__": diff --git a/plugins/modules/pritunl_user_info.py b/plugins/modules/pritunl_user_info.py index 7276570975..ccdb7e4dd0 100644 --- a/plugins/modules/pritunl_user_info.py +++ b/plugins/modules/pritunl_user_info.py @@ -90,7 +90,6 @@ users: """ from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.common.text.converters import to_native from ansible.module_utils.common.dict_transformations import dict_merge from ansible_collections.community.general.plugins.module_utils.net_tools.pritunl.api import ( PritunlException, @@ -150,7 +149,7 @@ def main(): try: get_pritunl_user(module) except PritunlException as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") if __name__ == "__main__": diff --git a/plugins/modules/read_csv.py b/plugins/modules/read_csv.py index cadc30d97c..edfd4586dc 100644 --- a/plugins/modules/read_csv.py +++ b/plugins/modules/read_csv.py @@ -144,7 +144,6 @@ list: """ from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.common.text.converters import to_native from ansible_collections.community.general.plugins.module_utils.csv import ( initialize_dialect, @@ -185,7 +184,7 @@ def main(): try: dialect = initialize_dialect(dialect, **dialect_params) except (CustomDialectFailureError, DialectNotAvailableError) as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") try: with open(path, "rb") as f: diff --git a/plugins/modules/selinux_permissive.py b/plugins/modules/selinux_permissive.py index 2e743d1791..13e9880f1e 100644 --- a/plugins/modules/selinux_permissive.py +++ b/plugins/modules/selinux_permissive.py @@ -69,7 +69,6 @@ except ImportError: SEOBJECT_IMP_ERR = traceback.format_exc() from ansible.module_utils.basic import AnsibleModule, missing_required_lib -from ansible.module_utils.common.text.converters import to_native def main(): @@ -96,7 +95,7 @@ def main(): try: permissive_domains = seobject.permissiveRecords(store) except ValueError as e: - module.fail_json(domain=domain, msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(domain=domain, msg=f"{e}", exception=traceback.format_exc()) # not supported on EL 6 if "set_reload" in dir(permissive_domains): @@ -105,7 +104,7 @@ def main(): try: all_domains = permissive_domains.get_all() except ValueError as e: - module.fail_json(domain=domain, msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(domain=domain, msg=f"{e}", exception=traceback.format_exc()) if permissive: if domain not in all_domains: @@ -113,7 +112,7 @@ def main(): try: permissive_domains.add(domain) except ValueError as e: - module.fail_json(domain=domain, msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(domain=domain, msg=f"{e}", exception=traceback.format_exc()) changed = True else: if domain in all_domains: @@ -121,7 +120,7 @@ def main(): try: permissive_domains.delete(domain) except ValueError as e: - module.fail_json(domain=domain, msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(domain=domain, msg=f"{e}", exception=traceback.format_exc()) changed = True module.exit_json(changed=changed, store=store, permissive=permissive, domain=domain) diff --git a/plugins/modules/sensu_check.py b/plugins/modules/sensu_check.py index e4ff236044..7ccaa577e6 100644 --- a/plugins/modules/sensu_check.py +++ b/plugins/modules/sensu_check.py @@ -184,7 +184,6 @@ import json import traceback from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.common.text.converters import to_native def sensu_check(module, path, name, state="present", backup=False): @@ -203,7 +202,7 @@ def sensu_check(module, path, name, state="present", backup=False): return changed, reasons config = {} else: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) except ValueError: msg = f"{path} contains invalid JSON" module.fail_json(msg=msg) @@ -325,7 +324,7 @@ def sensu_check(module, path, name, state="present", backup=False): stream = open(path, "w") stream.write(json.dumps(config, indent=2) + "\n") except IOError as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) finally: if stream: stream.close() diff --git a/plugins/modules/sensu_subscription.py b/plugins/modules/sensu_subscription.py index 909f9724ba..9ac9cb2fb3 100644 --- a/plugins/modules/sensu_subscription.py +++ b/plugins/modules/sensu_subscription.py @@ -88,7 +88,7 @@ def sensu_subscription(module, path, name, state="present", backup=False): return changed, reasons config = {} else: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) except ValueError: msg = f"{path} contains invalid JSON" module.fail_json(msg=msg) diff --git a/plugins/modules/sudoers.py b/plugins/modules/sudoers.py index 48a87cf3b6..60394c6bfd 100644 --- a/plugins/modules/sudoers.py +++ b/plugins/modules/sudoers.py @@ -159,7 +159,6 @@ EXAMPLES = r""" import os from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.common.text.converters import to_native class Sudoers: @@ -311,7 +310,7 @@ def main(): changed = sudoers.run() module.exit_json(changed=changed) except Exception as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") if __name__ == "__main__": diff --git a/plugins/modules/utm_aaa_group.py b/plugins/modules/utm_aaa_group.py index ba42731534..26930d3eec 100644 --- a/plugins/modules/utm_aaa_group.py +++ b/plugins/modules/utm_aaa_group.py @@ -197,7 +197,6 @@ result: """ from ansible_collections.community.general.plugins.module_utils.utm_utils import UTM, UTMModule -from ansible.module_utils.common.text.converters import to_native def main(): @@ -240,7 +239,7 @@ def main(): try: UTM(module, endpoint, key_to_check_for_changes).execute() except Exception as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") if __name__ == "__main__": diff --git a/plugins/modules/utm_aaa_group_info.py b/plugins/modules/utm_aaa_group_info.py index d3b11970cd..0ed3e2e568 100644 --- a/plugins/modules/utm_aaa_group_info.py +++ b/plugins/modules/utm_aaa_group_info.py @@ -102,7 +102,6 @@ result: """ from ansible_collections.community.general.plugins.module_utils.utm_utils import UTM, UTMModule -from ansible.module_utils.common.text.converters import to_native def main(): @@ -115,7 +114,7 @@ def main(): try: UTM(module, endpoint, key_to_check_for_changes, info_only=True).execute() except Exception as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") if __name__ == "__main__": diff --git a/plugins/modules/utm_ca_host_key_cert.py b/plugins/modules/utm_ca_host_key_cert.py index 6123954efb..d41f6100b0 100644 --- a/plugins/modules/utm_ca_host_key_cert.py +++ b/plugins/modules/utm_ca_host_key_cert.py @@ -134,7 +134,6 @@ result: """ from ansible_collections.community.general.plugins.module_utils.utm_utils import UTM, UTMModule -from ansible.module_utils.common.text.converters import to_native def main(): @@ -155,7 +154,7 @@ def main(): # This is needed because the bool value only accepts int values in the backend UTM(module, endpoint, key_to_check_for_changes).execute() except Exception as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") if __name__ == "__main__": diff --git a/plugins/modules/utm_ca_host_key_cert_info.py b/plugins/modules/utm_ca_host_key_cert_info.py index a1f343936e..5059e6a174 100644 --- a/plugins/modules/utm_ca_host_key_cert_info.py +++ b/plugins/modules/utm_ca_host_key_cert_info.py @@ -82,7 +82,6 @@ result: """ from ansible_collections.community.general.plugins.module_utils.utm_utils import UTM, UTMModule -from ansible.module_utils.common.text.converters import to_native def main(): @@ -96,7 +95,7 @@ def main(): # This is needed because the bool value only accepts int values in the backend UTM(module, endpoint, key_to_check_for_changes, info_only=True).execute() except Exception as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") if __name__ == "__main__": diff --git a/plugins/modules/utm_dns_host.py b/plugins/modules/utm_dns_host.py index d0b284a00e..f6204459c9 100644 --- a/plugins/modules/utm_dns_host.py +++ b/plugins/modules/utm_dns_host.py @@ -133,7 +133,6 @@ result: """ from ansible_collections.community.general.plugins.module_utils.utm_utils import UTM, UTMModule -from ansible.module_utils.common.text.converters import to_native def main(): @@ -155,7 +154,7 @@ def main(): try: UTM(module, endpoint, key_to_check_for_changes).execute() except Exception as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") if __name__ == "__main__": diff --git a/plugins/modules/utm_network_interface_address.py b/plugins/modules/utm_network_interface_address.py index a36279f374..6c999abf03 100644 --- a/plugins/modules/utm_network_interface_address.py +++ b/plugins/modules/utm_network_interface_address.py @@ -110,7 +110,6 @@ result: """ from ansible_collections.community.general.plugins.module_utils.utm_utils import UTM, UTMModule -from ansible.module_utils.common.text.converters import to_native def main(): @@ -129,7 +128,7 @@ def main(): try: UTM(module, endpoint, key_to_check_for_changes).execute() except Exception as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") if __name__ == "__main__": diff --git a/plugins/modules/utm_network_interface_address_info.py b/plugins/modules/utm_network_interface_address_info.py index 9ee203db2b..9714bcd28f 100644 --- a/plugins/modules/utm_network_interface_address_info.py +++ b/plugins/modules/utm_network_interface_address_info.py @@ -78,7 +78,6 @@ result: """ from ansible_collections.community.general.plugins.module_utils.utm_utils import UTM, UTMModule -from ansible.module_utils.common.text.converters import to_native def main(): @@ -91,7 +90,7 @@ def main(): try: UTM(module, endpoint, key_to_check_for_changes, info_only=True).execute() except Exception as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") if __name__ == "__main__": diff --git a/plugins/modules/utm_proxy_auth_profile.py b/plugins/modules/utm_proxy_auth_profile.py index b664c8dcad..dda4bdd629 100644 --- a/plugins/modules/utm_proxy_auth_profile.py +++ b/plugins/modules/utm_proxy_auth_profile.py @@ -294,7 +294,6 @@ result: """ from ansible_collections.community.general.plugins.module_utils.utm_utils import UTM, UTMModule -from ansible.module_utils.common.text.converters import to_native def main(): @@ -360,7 +359,7 @@ def main(): try: UTM(module, endpoint, key_to_check_for_changes).execute() except Exception as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") if __name__ == "__main__": diff --git a/plugins/modules/utm_proxy_exception.py b/plugins/modules/utm_proxy_exception.py index 55331250fa..221b12e37b 100644 --- a/plugins/modules/utm_proxy_exception.py +++ b/plugins/modules/utm_proxy_exception.py @@ -193,7 +193,6 @@ result: """ from ansible_collections.community.general.plugins.module_utils.utm_utils import UTM, UTMModule -from ansible.module_utils.common.text.converters import to_native def main(): @@ -237,7 +236,7 @@ def main(): try: UTM(module, endpoint, key_to_check_for_changes).execute() except Exception as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") if __name__ == "__main__": diff --git a/plugins/modules/utm_proxy_frontend.py b/plugins/modules/utm_proxy_frontend.py index 40d3184575..2b736e1ec4 100644 --- a/plugins/modules/utm_proxy_frontend.py +++ b/plugins/modules/utm_proxy_frontend.py @@ -237,7 +237,6 @@ result: """ from ansible_collections.community.general.plugins.module_utils.utm_utils import UTM, UTMModule -from ansible.module_utils.common.text.converters import to_native def main(): @@ -290,7 +289,7 @@ def main(): try: UTM(module, endpoint, key_to_check_for_changes).execute() except Exception as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") if __name__ == "__main__": diff --git a/plugins/modules/utm_proxy_frontend_info.py b/plugins/modules/utm_proxy_frontend_info.py index b8bd0da982..5f4a8f1a31 100644 --- a/plugins/modules/utm_proxy_frontend_info.py +++ b/plugins/modules/utm_proxy_frontend_info.py @@ -123,7 +123,6 @@ result: """ from ansible_collections.community.general.plugins.module_utils.utm_utils import UTM, UTMModule -from ansible.module_utils.common.text.converters import to_native def main(): @@ -138,7 +137,7 @@ def main(): try: UTM(module, endpoint, key_to_check_for_changes, info_only=True).execute() except Exception as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") if __name__ == "__main__": diff --git a/plugins/modules/utm_proxy_location.py b/plugins/modules/utm_proxy_location.py index d6b73fd7fb..e05d92f6da 100644 --- a/plugins/modules/utm_proxy_location.py +++ b/plugins/modules/utm_proxy_location.py @@ -185,7 +185,6 @@ result: """ from ansible_collections.community.general.plugins.module_utils.utm_utils import UTM, UTMModule -from ansible.module_utils.common.text.converters import to_native def main(): @@ -226,7 +225,7 @@ def main(): try: UTM(module, endpoint, key_to_check_for_changes).execute() except Exception as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") if __name__ == "__main__": diff --git a/plugins/modules/utm_proxy_location_info.py b/plugins/modules/utm_proxy_location_info.py index 5ea2267cb1..31a6e4b781 100644 --- a/plugins/modules/utm_proxy_location_info.py +++ b/plugins/modules/utm_proxy_location_info.py @@ -104,7 +104,6 @@ result: """ from ansible_collections.community.general.plugins.module_utils.utm_utils import UTM, UTMModule -from ansible.module_utils.common.text.converters import to_native def main(): @@ -119,7 +118,7 @@ def main(): try: UTM(module, endpoint, key_to_check_for_changes, info_only=True).execute() except Exception as e: - module.fail_json(msg=to_native(e)) + module.fail_json(msg=f"{e}") if __name__ == "__main__": diff --git a/plugins/modules/vertica_configuration.py b/plugins/modules/vertica_configuration.py index 35b1f719a0..f3a5e23585 100644 --- a/plugins/modules/vertica_configuration.py +++ b/plugins/modules/vertica_configuration.py @@ -79,7 +79,6 @@ else: pyodbc_found = True from ansible.module_utils.basic import AnsibleModule, missing_required_lib -from ansible.module_utils.common.text.converters import to_native class NotSupportedError(Exception): @@ -187,16 +186,16 @@ def main(): try: changed = present(configuration_facts, cursor, parameter_name, current_value) except pyodbc.Error as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) except NotSupportedError as e: - module.fail_json(msg=to_native(e), ansible_facts={"vertica_configuration": configuration_facts}) + module.fail_json(msg=f"{e}", ansible_facts={"vertica_configuration": configuration_facts}) except CannotDropError as e: - module.fail_json(msg=to_native(e), ansible_facts={"vertica_configuration": configuration_facts}) + module.fail_json(msg=f"{e}", ansible_facts={"vertica_configuration": configuration_facts}) except SystemExit: # avoid catching this on python 2.4 raise except Exception as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) module.exit_json( changed=changed, parameter=parameter_name, ansible_facts={"vertica_configuration": configuration_facts} diff --git a/plugins/modules/vertica_info.py b/plugins/modules/vertica_info.py index cfc0b93e47..126ec39d6e 100644 --- a/plugins/modules/vertica_info.py +++ b/plugins/modules/vertica_info.py @@ -70,7 +70,6 @@ else: pyodbc_found = True from ansible.module_utils.basic import AnsibleModule, missing_required_lib -from ansible.module_utils.common.text.converters import to_native class NotSupportedError(Exception): @@ -293,12 +292,12 @@ def main(): vertica_nodes=node_facts, ) except NotSupportedError as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) except SystemExit: # avoid catching this on python 2.4 raise except Exception as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) if __name__ == "__main__": diff --git a/plugins/modules/vertica_role.py b/plugins/modules/vertica_role.py index 413487e202..70c1bef45b 100644 --- a/plugins/modules/vertica_role.py +++ b/plugins/modules/vertica_role.py @@ -90,7 +90,6 @@ else: pyodbc_found = True from ansible.module_utils.basic import AnsibleModule, missing_required_lib -from ansible.module_utils.common.text.converters import to_native class NotSupportedError(Exception): @@ -227,21 +226,21 @@ def main(): try: changed = absent(role_facts, cursor, role, assigned_roles) except pyodbc.Error as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) elif state == "present": try: changed = present(role_facts, cursor, role, assigned_roles) except pyodbc.Error as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) except NotSupportedError as e: - module.fail_json(msg=to_native(e), ansible_facts={"vertica_roles": role_facts}) + module.fail_json(msg=f"{e}", ansible_facts={"vertica_roles": role_facts}) except CannotDropError as e: - module.fail_json(msg=to_native(e), ansible_facts={"vertica_roles": role_facts}) + module.fail_json(msg=f"{e}", ansible_facts={"vertica_roles": role_facts}) except SystemExit: # avoid catching this on python 2.4 raise except Exception as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) module.exit_json(changed=changed, role=role, ansible_facts={"vertica_roles": role_facts}) diff --git a/plugins/modules/vertica_schema.py b/plugins/modules/vertica_schema.py index aaecf0c9dc..944515d643 100644 --- a/plugins/modules/vertica_schema.py +++ b/plugins/modules/vertica_schema.py @@ -106,7 +106,6 @@ else: pyodbc_found = True from ansible.module_utils.basic import AnsibleModule, missing_required_lib -from ansible.module_utils.common.text.converters import to_native class NotSupportedError(Exception): @@ -314,21 +313,21 @@ def main(): try: changed = absent(schema_facts, cursor, schema, usage_roles, create_roles) except pyodbc.Error as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) elif state == "present": try: changed = present(schema_facts, cursor, schema, usage_roles, create_roles, owner) except pyodbc.Error as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) except NotSupportedError as e: - module.fail_json(msg=to_native(e), ansible_facts={"vertica_schemas": schema_facts}) + module.fail_json(msg=f"{e}", ansible_facts={"vertica_schemas": schema_facts}) except CannotDropError as e: - module.fail_json(msg=to_native(e), ansible_facts={"vertica_schemas": schema_facts}) + module.fail_json(msg=f"{e}", ansible_facts={"vertica_schemas": schema_facts}) except SystemExit: # avoid catching this on python 2.4 raise except Exception as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) module.exit_json(changed=changed, schema=schema, ansible_facts={"vertica_schemas": schema_facts}) diff --git a/plugins/modules/vertica_user.py b/plugins/modules/vertica_user.py index 19060e6da6..58b9e5a6fd 100644 --- a/plugins/modules/vertica_user.py +++ b/plugins/modules/vertica_user.py @@ -114,7 +114,6 @@ else: pyodbc_found = True from ansible.module_utils.basic import AnsibleModule, missing_required_lib -from ansible.module_utils.common.text.converters import to_native class NotSupportedError(Exception): @@ -365,23 +364,22 @@ def main(): try: changed = absent(user_facts, cursor, user, roles) except pyodbc.Error as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) elif state in ["present", "locked"]: try: changed = present( user_facts, cursor, user, profile, resource_pool, locked, password, expired, ldap, roles ) except pyodbc.Error as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) except NotSupportedError as e: - module.fail_json(msg=to_native(e), ansible_facts={"vertica_users": user_facts}) + module.fail_json(msg=f"{e}", ansible_facts={"vertica_users": user_facts}) except CannotDropError as e: - module.fail_json(msg=to_native(e), ansible_facts={"vertica_users": user_facts}) + module.fail_json(msg=f"{e}", ansible_facts={"vertica_users": user_facts}) except SystemExit: - # avoid catching this on python 2.4 raise except Exception as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) module.exit_json(changed=changed, user=user, ansible_facts={"vertica_users": user_facts}) diff --git a/plugins/modules/wakeonlan.py b/plugins/modules/wakeonlan.py index d6265e3984..f8558d4b1f 100644 --- a/plugins/modules/wakeonlan.py +++ b/plugins/modules/wakeonlan.py @@ -70,7 +70,6 @@ import struct import traceback from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.common.text.converters import to_native def wakeonlan(module, mac, broadcast, port): @@ -107,7 +106,7 @@ def wakeonlan(module, mac, broadcast, port): sock.sendto(data, (broadcast, port)) except socket.error as e: sock.close() - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=f"{e}", exception=traceback.format_exc()) sock.close()