mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-02-04 07:51:50 +00:00
replace batch of redundant to_native() 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
|
import traceback
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.common.text.converters import to_native
|
|
||||||
|
|
||||||
|
|
||||||
def core(module):
|
def core(module):
|
||||||
|
|
@ -99,7 +98,7 @@ def main():
|
||||||
try:
|
try:
|
||||||
core(module)
|
core(module)
|
||||||
except Exception as e:
|
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__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,6 @@ msg:
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.common.text.converters import to_native
|
|
||||||
|
|
||||||
|
|
||||||
def do_upgrade(module, image):
|
def do_upgrade(module, image):
|
||||||
|
|
@ -171,7 +170,7 @@ def main():
|
||||||
try:
|
try:
|
||||||
core(module)
|
core(module)
|
||||||
except Exception as e:
|
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__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,6 @@ import socket
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
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
|
from ansible.module_utils.urls import fetch_url
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -210,7 +209,7 @@ def main():
|
||||||
else:
|
else:
|
||||||
module.fail_json(msg=json.dumps(info))
|
module.fail_json(msg=json.dumps(info))
|
||||||
except Exception as e:
|
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__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,6 @@ except Exception:
|
||||||
HAS_DATADOG = False
|
HAS_DATADOG = False
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||||
from ansible.module_utils.common.text.converters import to_native
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
@ -193,7 +192,7 @@ def _post_event(module):
|
||||||
|
|
||||||
module.exit_json(changed=True, msg=msg)
|
module.exit_json(changed=True, msg=msg)
|
||||||
except Exception as e:
|
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__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -250,7 +250,6 @@ except Exception:
|
||||||
HAS_DATADOG = False
|
HAS_DATADOG = False
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||||
from ansible.module_utils.common.text.converters import to_native
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
@ -370,7 +369,7 @@ def _post_monitor(module, options):
|
||||||
else:
|
else:
|
||||||
module.exit_json(changed=True, msg=msg)
|
module.exit_json(changed=True, msg=msg)
|
||||||
except Exception as e:
|
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):
|
def _equal_dicts(a, b, ignore_keys):
|
||||||
|
|
@ -403,7 +402,7 @@ def _update_monitor(module, monitor, options):
|
||||||
else:
|
else:
|
||||||
module.exit_json(changed=True, msg=msg)
|
module.exit_json(changed=True, msg=msg)
|
||||||
except Exception as e:
|
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):
|
def install_monitor(module):
|
||||||
|
|
@ -448,7 +447,7 @@ def delete_monitor(module):
|
||||||
msg = api.Monitor.delete(monitor["id"])
|
msg = api.Monitor.delete(monitor["id"])
|
||||||
module.exit_json(changed=True, msg=msg)
|
module.exit_json(changed=True, msg=msg)
|
||||||
except Exception as e:
|
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):
|
def mute_monitor(module):
|
||||||
|
|
@ -471,7 +470,7 @@ def mute_monitor(module):
|
||||||
msg = api.Monitor.mute(id=monitor["id"], silenced=module.params["silenced"])
|
msg = api.Monitor.mute(id=monitor["id"], silenced=module.params["silenced"])
|
||||||
module.exit_json(changed=True, msg=msg)
|
module.exit_json(changed=True, msg=msg)
|
||||||
except Exception as e:
|
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):
|
def unmute_monitor(module):
|
||||||
|
|
@ -484,7 +483,7 @@ def unmute_monitor(module):
|
||||||
msg = api.Monitor.unmute(monitor["id"])
|
msg = api.Monitor.unmute(monitor["id"])
|
||||||
module.exit_json(changed=True, msg=msg)
|
module.exit_json(changed=True, msg=msg)
|
||||||
except Exception as e:
|
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__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,6 @@ except ImportError:
|
||||||
HAS_HPILO = False
|
HAS_HPILO = False
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||||
from ansible.module_utils.common.text.converters import to_native
|
|
||||||
|
|
||||||
|
|
||||||
# Suppress warnings from hpilo
|
# Suppress warnings from hpilo
|
||||||
|
|
@ -187,7 +186,7 @@ def main():
|
||||||
data = ilo.get_host_data()
|
data = ilo.get_host_data()
|
||||||
power_state = ilo.get_host_power_status()
|
power_state = ilo.get_host_power_status()
|
||||||
except hpilo.IloCommunicationError as e:
|
except hpilo.IloCommunicationError as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
for entry in data:
|
for entry in data:
|
||||||
if "type" not in entry:
|
if "type" not in entry:
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,6 @@ import tempfile
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible_collections.community.general.plugins.module_utils import deps
|
from ansible_collections.community.general.plugins.module_utils import deps
|
||||||
from ansible.module_utils.common.text.converters import to_native
|
|
||||||
|
|
||||||
|
|
||||||
with deps.declare("passlib"):
|
with deps.declare("passlib"):
|
||||||
|
|
@ -242,7 +241,7 @@ def main():
|
||||||
(msg, changed) = check_file_attrs(module, changed, msg)
|
(msg, changed) = check_file_attrs(module, changed, msg)
|
||||||
module.exit_json(msg=msg, changed=changed)
|
module.exit_json(msg=msg, changed=changed)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -311,7 +311,7 @@ def main():
|
||||||
check_mutually_exclusive(CATEGORY_COMMANDS_MUTUALLY_EXCLUSIVE[category], dict.fromkeys(command_list, True))
|
check_mutually_exclusive(CATEGORY_COMMANDS_MUTUALLY_EXCLUSIVE[category], dict.fromkeys(command_list, True))
|
||||||
|
|
||||||
except TypeError as e:
|
except TypeError as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
# Organize by Categories / Commands
|
# Organize by Categories / Commands
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,6 @@ query_results:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
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
|
from ansible_collections.community.general.plugins.module_utils.influxdb import InfluxDb
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -78,7 +77,7 @@ class AnsibleInfluxDBRead(InfluxDb):
|
||||||
if rs:
|
if rs:
|
||||||
return list(rs.get_points())
|
return list(rs.get_points())
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.module.fail_json(msg=to_native(e))
|
self.module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,6 @@ import json
|
||||||
|
|
||||||
from ansible.module_utils.urls import ConnectionError
|
from ansible.module_utils.urls import ConnectionError
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
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
|
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
|
user_result = user
|
||||||
break
|
break
|
||||||
except ConnectionError as e:
|
except ConnectionError as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
return user_result
|
return user_result
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -130,7 +129,7 @@ def check_user_password(module, client, user_name, user_password):
|
||||||
if e.code == 401:
|
if e.code == 401:
|
||||||
return False
|
return False
|
||||||
except ConnectionError as e:
|
except ConnectionError as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
finally:
|
finally:
|
||||||
# restore previous user
|
# restore previous user
|
||||||
client.switch_user(module.params["username"], module.params["password"])
|
client.switch_user(module.params["username"], module.params["password"])
|
||||||
|
|
@ -142,7 +141,7 @@ def set_user_password(module, client, user_name, user_password):
|
||||||
try:
|
try:
|
||||||
client.set_user_password(user_name, user_password)
|
client.set_user_password(user_name, user_password)
|
||||||
except ConnectionError as e:
|
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):
|
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:
|
try:
|
||||||
client.create_user(user_name, user_password, admin)
|
client.create_user(user_name, user_password, admin)
|
||||||
except ConnectionError as e:
|
except ConnectionError as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
|
|
||||||
def drop_user(module, client, user_name):
|
def drop_user(module, client, user_name):
|
||||||
|
|
@ -234,12 +233,12 @@ def main():
|
||||||
msg = json.loads(e.content)
|
msg = json.loads(e.content)
|
||||||
reason = msg["error"]
|
reason = msg["error"]
|
||||||
except (KeyError, ValueError):
|
except (KeyError, ValueError):
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
if reason != INFLUX_AUTH_FIRST_USER_REQUIRED:
|
if reason != INFLUX_AUTH_FIRST_USER_REQUIRED:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
else:
|
else:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
changed = False
|
changed = False
|
||||||
|
|
||||||
|
|
@ -259,7 +258,7 @@ def main():
|
||||||
client.revoke_admin_privileges(user_name)
|
client.revoke_admin_privileges(user_name)
|
||||||
changed = True
|
changed = True
|
||||||
except influx.exceptions.InfluxDBClientError as e:
|
except influx.exceptions.InfluxDBClientError as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
user_password = user_password or ""
|
user_password = user_password or ""
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,6 @@ RETURN = r"""
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
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
|
from ansible_collections.community.general.plugins.module_utils.influxdb import InfluxDb
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -74,7 +73,7 @@ class AnsibleInfluxDBWrite(InfluxDb):
|
||||||
try:
|
try:
|
||||||
client.write_points(data_points)
|
client.write_points(data_points)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.module.fail_json(msg=to_native(e))
|
self.module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
|
||||||
|
|
@ -231,7 +231,6 @@ import traceback
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible_collections.community.general.plugins.module_utils.ipa import IPAClient, ipa_argument_spec
|
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):
|
class ConfigIPAClient(IPAClient):
|
||||||
|
|
@ -391,7 +390,7 @@ def main():
|
||||||
changed, user = ensure(module, client)
|
changed, user = ensure(module, client)
|
||||||
module.exit_json(changed=changed, user=user)
|
module.exit_json(changed=changed, user=user)
|
||||||
except Exception as e:
|
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__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -365,7 +365,7 @@ def main():
|
||||||
changed, record = ensure(module, client)
|
changed, record = ensure(module, client)
|
||||||
module.exit_json(changed=changed, record=record)
|
module.exit_json(changed=changed, record=record)
|
||||||
except Exception as e:
|
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__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,6 @@ zone:
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible_collections.community.general.plugins.module_utils.ipa import IPAClient, ipa_argument_spec
|
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):
|
class DNSZoneIPAClient(IPAClient):
|
||||||
|
|
@ -188,7 +187,7 @@ def main():
|
||||||
changed, zone = ensure(module, client)
|
changed, zone = ensure(module, client)
|
||||||
module.exit_json(changed=changed, zone=zone)
|
module.exit_json(changed=changed, zone=zone)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,6 @@ import traceback
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible_collections.community.general.plugins.module_utils.ipa import IPAClient, ipa_argument_spec
|
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):
|
class GroupIPAClient(IPAClient):
|
||||||
|
|
@ -358,7 +357,7 @@ def main():
|
||||||
changed, group = ensure(module, client)
|
changed, group = ensure(module, client)
|
||||||
module.exit_json(changed=changed, group=group)
|
module.exit_json(changed=changed, group=group)
|
||||||
except Exception as e:
|
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__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,6 @@ import traceback
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible_collections.community.general.plugins.module_utils.ipa import IPAClient, ipa_argument_spec
|
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
|
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -430,7 +429,7 @@ def main():
|
||||||
changed, hbacrule = ensure(module, client)
|
changed, hbacrule = ensure(module, client)
|
||||||
module.exit_json(changed=changed, hbacrule=hbacrule)
|
module.exit_json(changed=changed, hbacrule=hbacrule)
|
||||||
except Exception as e:
|
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__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -185,7 +185,6 @@ import traceback
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible_collections.community.general.plugins.module_utils.ipa import IPAClient, ipa_argument_spec
|
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):
|
class HostIPAClient(IPAClient):
|
||||||
|
|
@ -351,7 +350,7 @@ def main():
|
||||||
changed, host = ensure(module, client)
|
changed, host = ensure(module, client)
|
||||||
module.exit_json(changed=changed, host=host)
|
module.exit_json(changed=changed, host=host)
|
||||||
except Exception as e:
|
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__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,6 @@ import traceback
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible_collections.community.general.plugins.module_utils.ipa import IPAClient, ipa_argument_spec
|
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):
|
class HostGroupIPAClient(IPAClient):
|
||||||
|
|
@ -234,7 +233,7 @@ def main():
|
||||||
changed, hostgroup = ensure(module, client)
|
changed, hostgroup = ensure(module, client)
|
||||||
module.exit_json(changed=changed, hostgroup=hostgroup)
|
module.exit_json(changed=changed, hostgroup=hostgroup)
|
||||||
except Exception as e:
|
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__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,6 @@ import traceback
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible_collections.community.general.plugins.module_utils.ipa import IPAClient, ipa_argument_spec
|
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):
|
class OTPConfigIPAClient(IPAClient):
|
||||||
|
|
@ -161,7 +160,7 @@ def main():
|
||||||
client.login(username=module.params["ipa_user"], password=module.params["ipa_pass"])
|
client.login(username=module.params["ipa_user"], password=module.params["ipa_pass"])
|
||||||
changed, otpconfig = ensure(module, client)
|
changed, otpconfig = ensure(module, client)
|
||||||
except Exception as e:
|
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)
|
module.exit_json(changed=changed, otpconfig=otpconfig)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,6 @@ import traceback
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule, sanitize_keys
|
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_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):
|
class OTPTokenIPAClient(IPAClient):
|
||||||
|
|
@ -546,7 +545,7 @@ def main():
|
||||||
client.login(username=module.params["ipa_user"], password=module.params["ipa_pass"])
|
client.login(username=module.params["ipa_user"], password=module.params["ipa_pass"])
|
||||||
changed, otptoken = ensure(module, client)
|
changed, otptoken = ensure(module, client)
|
||||||
except Exception as e:
|
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)
|
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"])
|
client.login(username=module.params["ipa_user"], password=module.params["ipa_pass"])
|
||||||
changed, pwpolicy = ensure(module, client)
|
changed, pwpolicy = ensure(module, client)
|
||||||
except Exception as e:
|
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)
|
module.exit_json(changed=changed, pwpolicy=pwpolicy)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,6 @@ import traceback
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible_collections.community.general.plugins.module_utils.ipa import IPAClient, ipa_argument_spec
|
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):
|
class RoleIPAClient(IPAClient):
|
||||||
|
|
@ -331,7 +330,7 @@ def main():
|
||||||
changed, role = ensure(module, client)
|
changed, role = ensure(module, client)
|
||||||
module.exit_json(changed=changed, role=role)
|
module.exit_json(changed=changed, role=role)
|
||||||
except Exception as e:
|
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__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,6 @@ import traceback
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible_collections.community.general.plugins.module_utils.ipa import IPAClient, ipa_argument_spec
|
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):
|
class ServiceIPAClient(IPAClient):
|
||||||
|
|
@ -212,7 +211,7 @@ def main():
|
||||||
changed, host = ensure(module, client)
|
changed, host = ensure(module, client)
|
||||||
module.exit_json(changed=changed, host=host)
|
module.exit_json(changed=changed, host=host)
|
||||||
except Exception as e:
|
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__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,6 @@ import traceback
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible_collections.community.general.plugins.module_utils.ipa import IPAClient, ipa_argument_spec
|
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):
|
class SudoCmdIPAClient(IPAClient):
|
||||||
|
|
@ -150,7 +149,7 @@ def main():
|
||||||
changed, sudocmd = ensure(module, client)
|
changed, sudocmd = ensure(module, client)
|
||||||
module.exit_json(changed=changed, sudocmd=sudocmd)
|
module.exit_json(changed=changed, sudocmd=sudocmd)
|
||||||
except Exception as e:
|
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__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,6 @@ import traceback
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible_collections.community.general.plugins.module_utils.ipa import IPAClient, ipa_argument_spec
|
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):
|
class SudoCmdGroupIPAClient(IPAClient):
|
||||||
|
|
@ -182,7 +181,7 @@ def main():
|
||||||
changed, sudocmdgroup = ensure(module, client)
|
changed, sudocmdgroup = ensure(module, client)
|
||||||
module.exit_json(changed=changed, sudorule=sudocmdgroup)
|
module.exit_json(changed=changed, sudorule=sudocmdgroup)
|
||||||
except Exception as e:
|
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__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -199,7 +199,6 @@ import traceback
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible_collections.community.general.plugins.module_utils.ipa import IPAClient, ipa_argument_spec
|
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
|
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -553,7 +552,7 @@ def main():
|
||||||
changed, sudorule = ensure(module, client)
|
changed, sudorule = ensure(module, client)
|
||||||
module.exit_json(changed=changed, sudorule=sudorule)
|
module.exit_json(changed=changed, sudorule=sudorule)
|
||||||
except Exception as e:
|
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__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,6 @@ import traceback
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible_collections.community.general.plugins.module_utils.ipa import IPAClient, ipa_argument_spec
|
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):
|
class UserIPAClient(IPAClient):
|
||||||
|
|
@ -422,7 +421,7 @@ def main():
|
||||||
changed, user = ensure(module, client)
|
changed, user = ensure(module, client)
|
||||||
module.exit_json(changed=changed, user=user)
|
module.exit_json(changed=changed, user=user)
|
||||||
except Exception as e:
|
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__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,6 @@ import traceback
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible_collections.community.general.plugins.module_utils.ipa import IPAClient, ipa_argument_spec
|
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):
|
class VaultIPAClient(IPAClient):
|
||||||
|
|
@ -252,7 +251,7 @@ def main():
|
||||||
changed, vault = ensure(module, client)
|
changed, vault = ensure(module, client)
|
||||||
module.exit_json(changed=changed, vault=vault)
|
module.exit_json(changed=changed, vault=vault)
|
||||||
except Exception as e:
|
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__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,6 @@ ansible_facts:
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import platform
|
import platform
|
||||||
from ansible.module_utils.common.text.converters import to_native
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -418,7 +417,7 @@ def main():
|
||||||
elif connection["protocol"].startswith("udp"):
|
elif connection["protocol"].startswith("udp"):
|
||||||
result["ansible_facts"]["udp_listen"].append(connection)
|
result["ansible_facts"]["udp_listen"].append(connection)
|
||||||
except (KeyError, EnvironmentError) as e:
|
except (KeyError, EnvironmentError) as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
module.exit_json(**result)
|
module.exit_json(**result)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,6 @@ import traceback
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.common.text.converters import to_native
|
|
||||||
|
|
||||||
RELEASE_VER = platform.release()
|
RELEASE_VER = platform.release()
|
||||||
MODULES_LOAD_LOCATION = "/etc/modules-load.d"
|
MODULES_LOAD_LOCATION = "/etc/modules-load.d"
|
||||||
|
|
@ -260,7 +259,7 @@ class Modprobe:
|
||||||
is_loaded = True
|
is_loaded = True
|
||||||
break
|
break
|
||||||
except (IOError, OSError) as e:
|
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
|
return is_loaded
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,7 @@ def run():
|
||||||
try:
|
try:
|
||||||
job_json = json.loads(job_json)
|
job_json = json.loads(job_json)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
job = dict()
|
job = dict()
|
||||||
job["job"] = job_json
|
job["job"] = job_json
|
||||||
try:
|
try:
|
||||||
|
|
@ -172,7 +172,7 @@ def run():
|
||||||
else:
|
else:
|
||||||
result = plan
|
result = plan
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
if module.params.get("content_format") == "hcl":
|
if module.params.get("content_format") == "hcl":
|
||||||
try:
|
try:
|
||||||
|
|
@ -195,7 +195,7 @@ def run():
|
||||||
else:
|
else:
|
||||||
result = plan
|
result = plan
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
if module.params.get("force_start"):
|
if module.params.get("force_start"):
|
||||||
try:
|
try:
|
||||||
|
|
@ -220,7 +220,7 @@ def run():
|
||||||
result = json.loads(result.text)
|
result = json.loads(result.text)
|
||||||
changed = True
|
changed = True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
if module.params.get("state") == "absent":
|
if module.params.get("state") == "absent":
|
||||||
try:
|
try:
|
||||||
|
|
@ -244,7 +244,7 @@ def run():
|
||||||
result = job
|
result = job
|
||||||
changed = True
|
changed = True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
module.exit_json(changed=changed, result=result)
|
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.basic import AnsibleModule, missing_required_lib
|
||||||
from ansible.module_utils.common.text.converters import to_native
|
|
||||||
|
|
||||||
import_nomad = None
|
import_nomad = None
|
||||||
try:
|
try:
|
||||||
|
|
@ -314,7 +313,7 @@ def run():
|
||||||
for job in job_list:
|
for job in job_list:
|
||||||
result.append(nomad_client.job.get_job(job.get("ID")))
|
result.append(nomad_client.job.get_job(job.get("ID")))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
if module.params.get("name"):
|
if module.params.get("name"):
|
||||||
filter = list()
|
filter = list()
|
||||||
|
|
@ -326,7 +325,7 @@ def run():
|
||||||
if not filter:
|
if not filter:
|
||||||
module.fail_json(msg=f"Couldn't find Job with id {module.params['name']}")
|
module.fail_json(msg=f"Couldn't find Job with id {module.params['name']}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
module.exit_json(changed=changed, result=result)
|
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.basic import AnsibleModule, missing_required_lib
|
||||||
from ansible.module_utils.common.text.converters import to_native
|
|
||||||
|
|
||||||
import_nomad = None
|
import_nomad = None
|
||||||
|
|
||||||
|
|
@ -235,7 +234,7 @@ def run(module):
|
||||||
changed = True
|
changed = True
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
token_info = {
|
token_info = {
|
||||||
|
|
@ -261,7 +260,7 @@ def run(module):
|
||||||
changed = True
|
changed = True
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
if module.params.get("state") == "absent":
|
if module.params.get("state") == "absent":
|
||||||
if not module.params.get("name"):
|
if not module.params.get("name"):
|
||||||
|
|
@ -280,7 +279,7 @@ def run(module):
|
||||||
msg = f"No token with name '{module.params['name']}' found"
|
msg = f"No token with name '{module.params['name']}' found"
|
||||||
|
|
||||||
except Exception as e:
|
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)
|
module.exit_json(changed=changed, msg=msg, result=result)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -199,7 +199,7 @@ class Pids:
|
||||||
try:
|
try:
|
||||||
self._pids = self._ps.get_pids_by_pattern(self._pattern, self._ignore_case)
|
self._pids = self._ps.get_pids_by_pattern(self._pattern, self._ignore_case)
|
||||||
except PSAdapterError as e:
|
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)
|
return self._module.exit_json(**self.result)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,6 @@ response:
|
||||||
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
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.module_utils.common.dict_transformations import dict_merge
|
||||||
from ansible_collections.community.general.plugins.module_utils.net_tools.pritunl.api import (
|
from ansible_collections.community.general.plugins.module_utils.net_tools.pritunl.api import (
|
||||||
PritunlException,
|
PritunlException,
|
||||||
|
|
@ -188,7 +187,7 @@ def main():
|
||||||
elif state == "absent":
|
elif state == "absent":
|
||||||
remove_pritunl_organization(module)
|
remove_pritunl_organization(module)
|
||||||
except PritunlException as e:
|
except PritunlException as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,6 @@ organizations:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
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.module_utils.common.dict_transformations import dict_merge
|
||||||
from ansible_collections.community.general.plugins.module_utils.net_tools.pritunl.api import (
|
from ansible_collections.community.general.plugins.module_utils.net_tools.pritunl.api import (
|
||||||
PritunlException,
|
PritunlException,
|
||||||
|
|
@ -115,7 +114,7 @@ def main():
|
||||||
try:
|
try:
|
||||||
get_pritunl_organizations(module)
|
get_pritunl_organizations(module)
|
||||||
except PritunlException as e:
|
except PritunlException as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,6 @@ response:
|
||||||
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
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.module_utils.common.dict_transformations import dict_merge
|
||||||
from ansible_collections.community.general.plugins.module_utils.net_tools.pritunl.api import (
|
from ansible_collections.community.general.plugins.module_utils.net_tools.pritunl.api import (
|
||||||
PritunlException,
|
PritunlException,
|
||||||
|
|
@ -331,7 +330,7 @@ def main():
|
||||||
elif state == "absent":
|
elif state == "absent":
|
||||||
remove_pritunl_user(module)
|
remove_pritunl_user(module)
|
||||||
except PritunlException as e:
|
except PritunlException as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,6 @@ users:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
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.module_utils.common.dict_transformations import dict_merge
|
||||||
from ansible_collections.community.general.plugins.module_utils.net_tools.pritunl.api import (
|
from ansible_collections.community.general.plugins.module_utils.net_tools.pritunl.api import (
|
||||||
PritunlException,
|
PritunlException,
|
||||||
|
|
@ -150,7 +149,7 @@ def main():
|
||||||
try:
|
try:
|
||||||
get_pritunl_user(module)
|
get_pritunl_user(module)
|
||||||
except PritunlException as e:
|
except PritunlException as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,6 @@ list:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
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 (
|
from ansible_collections.community.general.plugins.module_utils.csv import (
|
||||||
initialize_dialect,
|
initialize_dialect,
|
||||||
|
|
@ -185,7 +184,7 @@ def main():
|
||||||
try:
|
try:
|
||||||
dialect = initialize_dialect(dialect, **dialect_params)
|
dialect = initialize_dialect(dialect, **dialect_params)
|
||||||
except (CustomDialectFailureError, DialectNotAvailableError) as e:
|
except (CustomDialectFailureError, DialectNotAvailableError) as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(path, "rb") as f:
|
with open(path, "rb") as f:
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,6 @@ except ImportError:
|
||||||
SEOBJECT_IMP_ERR = traceback.format_exc()
|
SEOBJECT_IMP_ERR = traceback.format_exc()
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||||
from ansible.module_utils.common.text.converters import to_native
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
@ -96,7 +95,7 @@ def main():
|
||||||
try:
|
try:
|
||||||
permissive_domains = seobject.permissiveRecords(store)
|
permissive_domains = seobject.permissiveRecords(store)
|
||||||
except ValueError as e:
|
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
|
# not supported on EL 6
|
||||||
if "set_reload" in dir(permissive_domains):
|
if "set_reload" in dir(permissive_domains):
|
||||||
|
|
@ -105,7 +104,7 @@ def main():
|
||||||
try:
|
try:
|
||||||
all_domains = permissive_domains.get_all()
|
all_domains = permissive_domains.get_all()
|
||||||
except ValueError as e:
|
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 permissive:
|
||||||
if domain not in all_domains:
|
if domain not in all_domains:
|
||||||
|
|
@ -113,7 +112,7 @@ def main():
|
||||||
try:
|
try:
|
||||||
permissive_domains.add(domain)
|
permissive_domains.add(domain)
|
||||||
except ValueError as e:
|
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
|
changed = True
|
||||||
else:
|
else:
|
||||||
if domain in all_domains:
|
if domain in all_domains:
|
||||||
|
|
@ -121,7 +120,7 @@ def main():
|
||||||
try:
|
try:
|
||||||
permissive_domains.delete(domain)
|
permissive_domains.delete(domain)
|
||||||
except ValueError as e:
|
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
|
changed = True
|
||||||
|
|
||||||
module.exit_json(changed=changed, store=store, permissive=permissive, domain=domain)
|
module.exit_json(changed=changed, store=store, permissive=permissive, domain=domain)
|
||||||
|
|
|
||||||
|
|
@ -184,7 +184,6 @@ import json
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
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):
|
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
|
return changed, reasons
|
||||||
config = {}
|
config = {}
|
||||||
else:
|
else:
|
||||||
module.fail_json(msg=to_native(e), exception=traceback.format_exc())
|
module.fail_json(msg=f"{e}", exception=traceback.format_exc())
|
||||||
except ValueError:
|
except ValueError:
|
||||||
msg = f"{path} contains invalid JSON"
|
msg = f"{path} contains invalid JSON"
|
||||||
module.fail_json(msg=msg)
|
module.fail_json(msg=msg)
|
||||||
|
|
@ -325,7 +324,7 @@ def sensu_check(module, path, name, state="present", backup=False):
|
||||||
stream = open(path, "w")
|
stream = open(path, "w")
|
||||||
stream.write(json.dumps(config, indent=2) + "\n")
|
stream.write(json.dumps(config, indent=2) + "\n")
|
||||||
except IOError as e:
|
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:
|
finally:
|
||||||
if stream:
|
if stream:
|
||||||
stream.close()
|
stream.close()
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ def sensu_subscription(module, path, name, state="present", backup=False):
|
||||||
return changed, reasons
|
return changed, reasons
|
||||||
config = {}
|
config = {}
|
||||||
else:
|
else:
|
||||||
module.fail_json(msg=to_native(e), exception=traceback.format_exc())
|
module.fail_json(msg=f"{e}", exception=traceback.format_exc())
|
||||||
except ValueError:
|
except ValueError:
|
||||||
msg = f"{path} contains invalid JSON"
|
msg = f"{path} contains invalid JSON"
|
||||||
module.fail_json(msg=msg)
|
module.fail_json(msg=msg)
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,6 @@ EXAMPLES = r"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.common.text.converters import to_native
|
|
||||||
|
|
||||||
|
|
||||||
class Sudoers:
|
class Sudoers:
|
||||||
|
|
@ -311,7 +310,7 @@ def main():
|
||||||
changed = sudoers.run()
|
changed = sudoers.run()
|
||||||
module.exit_json(changed=changed)
|
module.exit_json(changed=changed)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -197,7 +197,6 @@ result:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.utm_utils import UTM, UTMModule
|
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():
|
def main():
|
||||||
|
|
@ -240,7 +239,7 @@ def main():
|
||||||
try:
|
try:
|
||||||
UTM(module, endpoint, key_to_check_for_changes).execute()
|
UTM(module, endpoint, key_to_check_for_changes).execute()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,6 @@ result:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.utm_utils import UTM, UTMModule
|
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():
|
def main():
|
||||||
|
|
@ -115,7 +114,7 @@ def main():
|
||||||
try:
|
try:
|
||||||
UTM(module, endpoint, key_to_check_for_changes, info_only=True).execute()
|
UTM(module, endpoint, key_to_check_for_changes, info_only=True).execute()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,6 @@ result:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.utm_utils import UTM, UTMModule
|
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():
|
def main():
|
||||||
|
|
@ -155,7 +154,7 @@ def main():
|
||||||
# This is needed because the bool value only accepts int values in the backend
|
# This is needed because the bool value only accepts int values in the backend
|
||||||
UTM(module, endpoint, key_to_check_for_changes).execute()
|
UTM(module, endpoint, key_to_check_for_changes).execute()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,6 @@ result:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.utm_utils import UTM, UTMModule
|
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():
|
def main():
|
||||||
|
|
@ -96,7 +95,7 @@ def main():
|
||||||
# This is needed because the bool value only accepts int values in the backend
|
# 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()
|
UTM(module, endpoint, key_to_check_for_changes, info_only=True).execute()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,6 @@ result:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.utm_utils import UTM, UTMModule
|
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():
|
def main():
|
||||||
|
|
@ -155,7 +154,7 @@ def main():
|
||||||
try:
|
try:
|
||||||
UTM(module, endpoint, key_to_check_for_changes).execute()
|
UTM(module, endpoint, key_to_check_for_changes).execute()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,6 @@ result:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.utm_utils import UTM, UTMModule
|
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():
|
def main():
|
||||||
|
|
@ -129,7 +128,7 @@ def main():
|
||||||
try:
|
try:
|
||||||
UTM(module, endpoint, key_to_check_for_changes).execute()
|
UTM(module, endpoint, key_to_check_for_changes).execute()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,6 @@ result:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.utm_utils import UTM, UTMModule
|
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():
|
def main():
|
||||||
|
|
@ -91,7 +90,7 @@ def main():
|
||||||
try:
|
try:
|
||||||
UTM(module, endpoint, key_to_check_for_changes, info_only=True).execute()
|
UTM(module, endpoint, key_to_check_for_changes, info_only=True).execute()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -294,7 +294,6 @@ result:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.utm_utils import UTM, UTMModule
|
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():
|
def main():
|
||||||
|
|
@ -360,7 +359,7 @@ def main():
|
||||||
try:
|
try:
|
||||||
UTM(module, endpoint, key_to_check_for_changes).execute()
|
UTM(module, endpoint, key_to_check_for_changes).execute()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -193,7 +193,6 @@ result:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.utm_utils import UTM, UTMModule
|
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():
|
def main():
|
||||||
|
|
@ -237,7 +236,7 @@ def main():
|
||||||
try:
|
try:
|
||||||
UTM(module, endpoint, key_to_check_for_changes).execute()
|
UTM(module, endpoint, key_to_check_for_changes).execute()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -237,7 +237,6 @@ result:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.utm_utils import UTM, UTMModule
|
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():
|
def main():
|
||||||
|
|
@ -290,7 +289,7 @@ def main():
|
||||||
try:
|
try:
|
||||||
UTM(module, endpoint, key_to_check_for_changes).execute()
|
UTM(module, endpoint, key_to_check_for_changes).execute()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,6 @@ result:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.utm_utils import UTM, UTMModule
|
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():
|
def main():
|
||||||
|
|
@ -138,7 +137,7 @@ def main():
|
||||||
try:
|
try:
|
||||||
UTM(module, endpoint, key_to_check_for_changes, info_only=True).execute()
|
UTM(module, endpoint, key_to_check_for_changes, info_only=True).execute()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -185,7 +185,6 @@ result:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.utm_utils import UTM, UTMModule
|
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():
|
def main():
|
||||||
|
|
@ -226,7 +225,7 @@ def main():
|
||||||
try:
|
try:
|
||||||
UTM(module, endpoint, key_to_check_for_changes).execute()
|
UTM(module, endpoint, key_to_check_for_changes).execute()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,6 @@ result:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.utm_utils import UTM, UTMModule
|
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():
|
def main():
|
||||||
|
|
@ -119,7 +118,7 @@ def main():
|
||||||
try:
|
try:
|
||||||
UTM(module, endpoint, key_to_check_for_changes, info_only=True).execute()
|
UTM(module, endpoint, key_to_check_for_changes, info_only=True).execute()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=to_native(e))
|
module.fail_json(msg=f"{e}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,6 @@ else:
|
||||||
pyodbc_found = True
|
pyodbc_found = True
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||||
from ansible.module_utils.common.text.converters import to_native
|
|
||||||
|
|
||||||
|
|
||||||
class NotSupportedError(Exception):
|
class NotSupportedError(Exception):
|
||||||
|
|
@ -187,16 +186,16 @@ def main():
|
||||||
try:
|
try:
|
||||||
changed = present(configuration_facts, cursor, parameter_name, current_value)
|
changed = present(configuration_facts, cursor, parameter_name, current_value)
|
||||||
except pyodbc.Error as e:
|
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:
|
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:
|
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:
|
except SystemExit:
|
||||||
# avoid catching this on python 2.4
|
# avoid catching this on python 2.4
|
||||||
raise
|
raise
|
||||||
except Exception as e:
|
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(
|
module.exit_json(
|
||||||
changed=changed, parameter=parameter_name, ansible_facts={"vertica_configuration": configuration_facts}
|
changed=changed, parameter=parameter_name, ansible_facts={"vertica_configuration": configuration_facts}
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,6 @@ else:
|
||||||
pyodbc_found = True
|
pyodbc_found = True
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||||
from ansible.module_utils.common.text.converters import to_native
|
|
||||||
|
|
||||||
|
|
||||||
class NotSupportedError(Exception):
|
class NotSupportedError(Exception):
|
||||||
|
|
@ -293,12 +292,12 @@ def main():
|
||||||
vertica_nodes=node_facts,
|
vertica_nodes=node_facts,
|
||||||
)
|
)
|
||||||
except NotSupportedError as e:
|
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:
|
except SystemExit:
|
||||||
# avoid catching this on python 2.4
|
# avoid catching this on python 2.4
|
||||||
raise
|
raise
|
||||||
except Exception as e:
|
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__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,6 @@ else:
|
||||||
pyodbc_found = True
|
pyodbc_found = True
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||||
from ansible.module_utils.common.text.converters import to_native
|
|
||||||
|
|
||||||
|
|
||||||
class NotSupportedError(Exception):
|
class NotSupportedError(Exception):
|
||||||
|
|
@ -227,21 +226,21 @@ def main():
|
||||||
try:
|
try:
|
||||||
changed = absent(role_facts, cursor, role, assigned_roles)
|
changed = absent(role_facts, cursor, role, assigned_roles)
|
||||||
except pyodbc.Error as e:
|
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":
|
elif state == "present":
|
||||||
try:
|
try:
|
||||||
changed = present(role_facts, cursor, role, assigned_roles)
|
changed = present(role_facts, cursor, role, assigned_roles)
|
||||||
except pyodbc.Error as e:
|
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:
|
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:
|
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:
|
except SystemExit:
|
||||||
# avoid catching this on python 2.4
|
# avoid catching this on python 2.4
|
||||||
raise
|
raise
|
||||||
except Exception as e:
|
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})
|
module.exit_json(changed=changed, role=role, ansible_facts={"vertica_roles": role_facts})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,6 @@ else:
|
||||||
pyodbc_found = True
|
pyodbc_found = True
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||||
from ansible.module_utils.common.text.converters import to_native
|
|
||||||
|
|
||||||
|
|
||||||
class NotSupportedError(Exception):
|
class NotSupportedError(Exception):
|
||||||
|
|
@ -314,21 +313,21 @@ def main():
|
||||||
try:
|
try:
|
||||||
changed = absent(schema_facts, cursor, schema, usage_roles, create_roles)
|
changed = absent(schema_facts, cursor, schema, usage_roles, create_roles)
|
||||||
except pyodbc.Error as e:
|
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":
|
elif state == "present":
|
||||||
try:
|
try:
|
||||||
changed = present(schema_facts, cursor, schema, usage_roles, create_roles, owner)
|
changed = present(schema_facts, cursor, schema, usage_roles, create_roles, owner)
|
||||||
except pyodbc.Error as e:
|
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:
|
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:
|
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:
|
except SystemExit:
|
||||||
# avoid catching this on python 2.4
|
# avoid catching this on python 2.4
|
||||||
raise
|
raise
|
||||||
except Exception as e:
|
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})
|
module.exit_json(changed=changed, schema=schema, ansible_facts={"vertica_schemas": schema_facts})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,6 @@ else:
|
||||||
pyodbc_found = True
|
pyodbc_found = True
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||||
from ansible.module_utils.common.text.converters import to_native
|
|
||||||
|
|
||||||
|
|
||||||
class NotSupportedError(Exception):
|
class NotSupportedError(Exception):
|
||||||
|
|
@ -365,23 +364,22 @@ def main():
|
||||||
try:
|
try:
|
||||||
changed = absent(user_facts, cursor, user, roles)
|
changed = absent(user_facts, cursor, user, roles)
|
||||||
except pyodbc.Error as e:
|
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"]:
|
elif state in ["present", "locked"]:
|
||||||
try:
|
try:
|
||||||
changed = present(
|
changed = present(
|
||||||
user_facts, cursor, user, profile, resource_pool, locked, password, expired, ldap, roles
|
user_facts, cursor, user, profile, resource_pool, locked, password, expired, ldap, roles
|
||||||
)
|
)
|
||||||
except pyodbc.Error as e:
|
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:
|
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:
|
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:
|
except SystemExit:
|
||||||
# avoid catching this on python 2.4
|
|
||||||
raise
|
raise
|
||||||
except Exception as e:
|
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})
|
module.exit_json(changed=changed, user=user, ansible_facts={"vertica_users": user_facts})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,6 @@ import struct
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.common.text.converters import to_native
|
|
||||||
|
|
||||||
|
|
||||||
def wakeonlan(module, mac, broadcast, port):
|
def wakeonlan(module, mac, broadcast, port):
|
||||||
|
|
@ -107,7 +106,7 @@ def wakeonlan(module, mac, broadcast, port):
|
||||||
sock.sendto(data, (broadcast, port))
|
sock.sendto(data, (broadcast, port))
|
||||||
except socket.error as e:
|
except socket.error as e:
|
||||||
sock.close()
|
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()
|
sock.close()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue