mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-02-03 23:41:51 +00:00
replace batch of redundant to_native() occurrences (#11098)
* replace batch of redundant to_native() occurrences * add changelog frag
This commit is contained in:
parent
6e1cc3eafd
commit
634be713bb
63 changed files with 164 additions and 157 deletions
64
changelogs/fragments/11098-tonative-1.yml
Normal file
64
changelogs/fragments/11098-tonative-1.yml
Normal file
|
|
@ -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).
|
||||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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():
|
||||
|
|
|
|||
|
|
@ -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 ""
|
||||
|
|
|
|||
|
|
@ -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():
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
|
|
@ -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})
|
||||
|
||||
|
|
|
|||
|
|
@ -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})
|
||||
|
||||
|
|
|
|||
|
|
@ -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})
|
||||
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue