mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-03-22 05:09:12 +00:00
[PR #11102/e5ee3eb8 backport][stable-12] replace batch of redundant to_native() occurrences (#11137)
replace batch of redundant to_native() occurrences (#11102)
* replace batch of redundant to_native() occurrences
* add changelog frag
* Update plugins/modules/idrac_redfish_config.py
* reformat
* Apply suggestions from code review
* Update plugins/modules/dimensiondata_network.py
---------
(cherry picked from commit e5ee3eb88b)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
b72e38c909
commit
50ae8fd7ae
13 changed files with 42 additions and 42 deletions
|
|
@ -178,7 +178,6 @@ import datetime
|
|||
import json
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
from ansible.module_utils.urls import open_url
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.datetime import (
|
||||
|
|
@ -198,7 +197,7 @@ def get_api_auth_headers(api_id, api_key, url, statuspage):
|
|||
auth_headers = headers
|
||||
auth_content = data
|
||||
except Exception as e:
|
||||
return 1, None, None, to_native(e)
|
||||
return 1, None, None, f"{e}"
|
||||
return 0, auth_headers, auth_content, None
|
||||
|
||||
|
||||
|
|
@ -310,7 +309,7 @@ def create_maintenance(
|
|||
if data["status"]["error"] == "yes":
|
||||
return 1, None, data["status"]["message"]
|
||||
except Exception as e:
|
||||
return 1, None, to_native(e)
|
||||
return 1, None, f"{e}"
|
||||
return 0, None, None
|
||||
|
||||
|
||||
|
|
@ -327,7 +326,7 @@ def delete_maintenance(auth_headers, url, statuspage, maintenance_id):
|
|||
if data["status"]["error"] == "yes":
|
||||
return 1, None, "Invalid maintenance_id"
|
||||
except Exception as e:
|
||||
return 1, None, to_native(e)
|
||||
return 1, None, f"{e}"
|
||||
return 0, None, None
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue