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

[PR #11098/634be713 backport][stable-12] replace batch of redundant to_native() occurrences (#11100)

replace batch of redundant to_native() occurrences (#11098)

* replace batch of redundant to_native() occurrences

* add changelog frag

(cherry picked from commit 634be713bb)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2025-11-11 07:23:07 +01:00 committed by GitHub
parent 5be39ee0c3
commit d487734fea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
63 changed files with 164 additions and 157 deletions

View file

@ -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__":