mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-02-04 07:51:50 +00:00
[PR #11143/23e81b8d backport][stable-12] replace redundant to_native()/to_text() occurrences, batch 8 (#11164)
replace redundant to_native()/to_text() occurrences, batch 8 (#11143)
* replace redundant to_native()/to_text() occurrences, batch 8
* add changelog frag
* Update plugins/modules/jira.py
---------
(cherry picked from commit 23e81b8d30)
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
15d4fff749
commit
8a7f360558
22 changed files with 68 additions and 58 deletions
22
changelogs/fragments/11143-tonative-8.yml
Normal file
22
changelogs/fragments/11143-tonative-8.yml
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
minor_changes:
|
||||
- cloudflare_dns - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/1114).
|
||||
- dconf - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/1114).
|
||||
- idrac_redfish_command - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/1114).
|
||||
- idrac_redfish_config - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/1114).
|
||||
- idrac_redfish_info - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/1114).
|
||||
- ilo_redfish_command - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/1114).
|
||||
- ilo_redfish_config - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/1114).
|
||||
- jenkins_plugin - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/1114).
|
||||
- jenkins_script - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/1114).
|
||||
- jira - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/1114).
|
||||
- mail - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/1114).
|
||||
- maven_artifact - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/1114).
|
||||
- onepassword_info - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/1114).
|
||||
- packet_volume - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/1114).
|
||||
- redfish_command - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/1114).
|
||||
- redfish_config - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/1114).
|
||||
- sensu_silence - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/1114).
|
||||
- svc - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/1114).
|
||||
- wdc_redfish_command - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/1114).
|
||||
- wdc_redfish_info - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/1114).
|
||||
- xcc_redfish_command - remove redundant conversions to unicode (https://github.com/ansible-collections/community.general/pull/1114).
|
||||
|
|
@ -441,7 +441,7 @@ import json
|
|||
from urllib.parse import urlencode
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule, env_fallback
|
||||
from ansible.module_utils.common.text.converters import to_native, to_text
|
||||
from ansible.module_utils.common.text.converters import to_text
|
||||
from ansible.module_utils.urls import fetch_url
|
||||
|
||||
|
||||
|
|
@ -587,7 +587,7 @@ class CloudflareAPI:
|
|||
try:
|
||||
result = json.loads(to_text(content, errors="surrogate_or_strict"))
|
||||
except getattr(json, "JSONDecodeError", ValueError) as e:
|
||||
error_msg += f"; Failed to parse API response with error {to_native(e)}: {content}"
|
||||
error_msg += f"; Failed to parse API response with error {e}: {content}"
|
||||
|
||||
# Without a valid/parsed JSON response no more error processing can be done
|
||||
if result is None:
|
||||
|
|
|
|||
|
|
@ -130,7 +130,6 @@ from ansible.module_utils.common.respawn import (
|
|||
probe_interpreters_for_module,
|
||||
respawn_module,
|
||||
)
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
from ansible_collections.community.general.plugins.module_utils import deps
|
||||
|
||||
glib_module_name = "gi.repository.GLib"
|
||||
|
|
@ -442,7 +441,7 @@ def main():
|
|||
if isinstance(module.params["value"], bool):
|
||||
module.params["value"] = "true" if module.params["value"] else "false"
|
||||
else:
|
||||
module.params["value"] = to_native(module.params["value"], errors="surrogate_or_strict")
|
||||
module.params["value"] = str(module.params["value"])
|
||||
|
||||
if Variant is None:
|
||||
module.warn(
|
||||
|
|
|
|||
|
|
@ -101,7 +101,6 @@ from ansible_collections.community.general.plugins.module_utils.redfish_utils im
|
|||
RedfishUtils,
|
||||
REDFISH_COMMON_ARGUMENT_SPEC,
|
||||
)
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
|
||||
class IdracRedfishUtils(RedfishUtils):
|
||||
|
|
@ -217,14 +216,14 @@ def main():
|
|||
result = rf_utils._find_systems_resource()
|
||||
rf_utils.data_modification = True
|
||||
if result["ret"] is False:
|
||||
module.fail_json(msg=to_native(result["msg"]))
|
||||
module.fail_json(msg=result["msg"])
|
||||
|
||||
for command in command_list:
|
||||
if command == "CreateBiosConfigJob":
|
||||
# execute only if we find a Managers resource
|
||||
result = rf_utils._find_managers_resource()
|
||||
if result["ret"] is False:
|
||||
module.fail_json(msg=to_native(result["msg"]))
|
||||
module.fail_json(msg=result["msg"])
|
||||
result = rf_utils.create_bios_config_job()
|
||||
if "job_id" in result:
|
||||
return_values["job_id"] = result["job_id"]
|
||||
|
|
@ -234,7 +233,7 @@ def main():
|
|||
del result["ret"]
|
||||
module.exit_json(changed=True, msg="Action was successful", return_values=return_values)
|
||||
else:
|
||||
module.fail_json(msg=to_native(result["msg"]))
|
||||
module.fail_json(msg=result["msg"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
|
|
@ -158,7 +158,6 @@ from ansible_collections.community.general.plugins.module_utils.redfish_utils im
|
|||
RedfishUtils,
|
||||
REDFISH_COMMON_ARGUMENT_SPEC,
|
||||
)
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
|
||||
class IdracRedfishUtils(RedfishUtils):
|
||||
|
|
@ -314,7 +313,7 @@ def main():
|
|||
# execute only if we find a Manager resource
|
||||
result = rf_utils._find_managers_resource()
|
||||
if result["ret"] is False:
|
||||
module.fail_json(msg=to_native(result["msg"]))
|
||||
module.fail_json(msg=result["msg"])
|
||||
|
||||
for command in command_list:
|
||||
if command in ["SetManagerAttributes", "SetLifecycleControllerAttributes", "SetSystemAttributes"]:
|
||||
|
|
@ -323,11 +322,11 @@ def main():
|
|||
# Return data back or fail with proper message
|
||||
if result["ret"] is True:
|
||||
if result.get("warning"):
|
||||
module.warn(to_native(result["warning"]))
|
||||
module.warn(result["warning"])
|
||||
|
||||
module.exit_json(changed=result["changed"], msg=to_native(result["msg"]))
|
||||
module.exit_json(changed=result["changed"], msg=result["msg"])
|
||||
else:
|
||||
module.fail_json(msg=to_native(result["msg"]))
|
||||
module.fail_json(msg=result["msg"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
|
|
@ -133,7 +133,6 @@ from ansible_collections.community.general.plugins.module_utils.redfish_utils im
|
|||
RedfishUtils,
|
||||
REDFISH_COMMON_ARGUMENT_SPEC,
|
||||
)
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
|
||||
class IdracRedfishUtils(RedfishUtils):
|
||||
|
|
@ -235,7 +234,7 @@ def main():
|
|||
# execute only if we find a Manager resource
|
||||
result = rf_utils._find_managers_resource()
|
||||
if result["ret"] is False:
|
||||
module.fail_json(msg=to_native(result["msg"]))
|
||||
module.fail_json(msg=result["msg"])
|
||||
|
||||
for command in command_list:
|
||||
if command == "GetManagerAttributes":
|
||||
|
|
@ -246,7 +245,7 @@ def main():
|
|||
del result["ret"]
|
||||
module.exit_json(redfish_facts=result)
|
||||
else:
|
||||
module.fail_json(msg=to_native(result["msg"]))
|
||||
module.fail_json(msg=result["msg"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
|
|
@ -97,7 +97,6 @@ CATEGORY_COMMANDS_ALL = {"Systems": ["WaitforiLORebootCompletion"]}
|
|||
from ansible_collections.community.general.plugins.module_utils.ilo_redfish_utils import iLORedfishUtils
|
||||
from ansible_collections.community.general.plugins.module_utils.redfish_utils import REDFISH_COMMON_ARGUMENT_SPEC
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
|
||||
def main():
|
||||
|
|
@ -153,7 +152,7 @@ def main():
|
|||
|
||||
result = rf_utils._find_systems_resource()
|
||||
if result["ret"] is False:
|
||||
module.fail_json(msg=to_native(result["msg"]))
|
||||
module.fail_json(msg=result["msg"])
|
||||
|
||||
for command in command_list:
|
||||
if command == "WaitforiLORebootCompletion":
|
||||
|
|
|
|||
|
|
@ -117,7 +117,6 @@ CATEGORY_COMMANDS_ALL = {"Manager": ["SetTimeZone", "SetDNSserver", "SetDomainNa
|
|||
from ansible_collections.community.general.plugins.module_utils.ilo_redfish_utils import iLORedfishUtils
|
||||
from ansible_collections.community.general.plugins.module_utils.redfish_utils import REDFISH_COMMON_ARGUMENT_SPEC
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
|
||||
def main():
|
||||
|
|
@ -171,7 +170,7 @@ def main():
|
|||
if category == "Manager":
|
||||
resource = rf_utils._find_managers_resource()
|
||||
if not resource["ret"]:
|
||||
module.fail_json(msg=to_native(resource["msg"]))
|
||||
module.fail_json(msg=resource["msg"])
|
||||
|
||||
dispatch = dict(
|
||||
SetTimeZone=rf_utils.set_time_zone,
|
||||
|
|
|
|||
|
|
@ -342,7 +342,6 @@ from urllib.parse import urlencode
|
|||
|
||||
from ansible.module_utils.basic import AnsibleModule, to_bytes
|
||||
from ansible.module_utils.urls import fetch_url, url_argument_spec, basic_auth_header
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.jenkins import download_updates_file
|
||||
|
||||
|
|
@ -399,7 +398,7 @@ class JenkinsPlugin:
|
|||
|
||||
# Parse the JSON data
|
||||
try:
|
||||
json_data = json.loads(to_native(r.read()))
|
||||
json_data = json.loads(r.read())
|
||||
except Exception as e:
|
||||
self.module.fail_json(msg=f"Cannot parse {what} JSON data.", details=f"{e}")
|
||||
|
||||
|
|
@ -683,7 +682,7 @@ class JenkinsPlugin:
|
|||
now = time.time()
|
||||
if now - file_mtime >= 86400:
|
||||
response = self._get_urls_data(plugin_version_urls, what="plugin-versions.json")
|
||||
plugin_data = json.loads(to_native(response.read()), object_pairs_hook=OrderedDict)
|
||||
plugin_data = json.loads(response.read(), object_pairs_hook=OrderedDict)
|
||||
|
||||
# Save it to file for next time
|
||||
with open(cache_path, "w") as f:
|
||||
|
|
|
|||
|
|
@ -115,8 +115,7 @@ def is_csrf_protection_enabled(module):
|
|||
if info["status"] != 200:
|
||||
module.fail_json(msg=f"HTTP error {info['status']} {info['msg']}", output="")
|
||||
|
||||
content = to_native(resp.read())
|
||||
return json.loads(content).get("useCrumbs", False)
|
||||
return json.loads(resp.read()).get("useCrumbs", False)
|
||||
|
||||
|
||||
def get_crumb(module, cookies):
|
||||
|
|
@ -130,8 +129,7 @@ def get_crumb(module, cookies):
|
|||
if info["status"] != 200:
|
||||
module.fail_json(msg=f"HTTP error {info['status']} {info['msg']}", output="")
|
||||
|
||||
content = to_native(resp.read())
|
||||
return json.loads(content)
|
||||
return json.loads(resp.read())
|
||||
|
||||
|
||||
def main():
|
||||
|
|
|
|||
|
|
@ -759,7 +759,7 @@ class JIRA(StateModuleHelper):
|
|||
return s.replace('"', '\\"')
|
||||
|
||||
boundary = "".join(random.choice(string.digits + string.ascii_letters) for dummy in range(30))
|
||||
name = to_native(os.path.basename(filename))
|
||||
name = os.path.basename(filename)
|
||||
|
||||
if not mime_type:
|
||||
try:
|
||||
|
|
@ -833,12 +833,12 @@ class JIRA(StateModuleHelper):
|
|||
error = json.loads(info["body"])
|
||||
except Exception:
|
||||
msg = f'The request "{method} {url}" returned the unexpected status code {info["status"]} {info["msg"]}\n{info.get("body")}'
|
||||
self.module.fail_json(msg=to_native(msg), exception=traceback.format_exc())
|
||||
self.module.fail_json(msg=msg, exception=traceback.format_exc())
|
||||
if error:
|
||||
msg = []
|
||||
for key in ("errorMessages", "errors"):
|
||||
if error.get(key):
|
||||
msg.append(to_native(error[key]))
|
||||
msg.append(str(error[key]))
|
||||
if msg:
|
||||
self.module.fail_json(msg=", ".join(msg))
|
||||
self.module.fail_json(msg=f"{error}")
|
||||
|
|
|
|||
|
|
@ -291,7 +291,7 @@ def main():
|
|||
if secure == "always":
|
||||
module.fail_json(
|
||||
rc=1,
|
||||
msg=f"Unable to start an encrypted session to {host}:{port}: {to_native(e)}",
|
||||
msg=f"Unable to start an encrypted session to {host}:{port}: {e}",
|
||||
exception=traceback.format_exc(),
|
||||
)
|
||||
except Exception:
|
||||
|
|
@ -302,14 +302,12 @@ def main():
|
|||
code, smtpmessage = smtp.connect(host, port)
|
||||
|
||||
except smtplib.SMTPException as e:
|
||||
module.fail_json(rc=1, msg=f"Unable to Connect {host}:{port}: {to_native(e)}", exception=traceback.format_exc())
|
||||
module.fail_json(rc=1, msg=f"Unable to Connect {host}:{port}: {e}", exception=traceback.format_exc())
|
||||
|
||||
try:
|
||||
smtp.ehlo()
|
||||
except smtplib.SMTPException as e:
|
||||
module.fail_json(
|
||||
rc=1, msg=f"Helo failed for host {host}:{port}: {to_native(e)}", exception=traceback.format_exc()
|
||||
)
|
||||
module.fail_json(rc=1, msg=f"Helo failed for host {host}:{port}: {e}", exception=traceback.format_exc())
|
||||
|
||||
if int(code) > 0:
|
||||
if not secure_state and secure in ("starttls", "try"):
|
||||
|
|
@ -361,7 +359,7 @@ def main():
|
|||
for hdr in [x.strip() for x in header.split("|")]:
|
||||
try:
|
||||
h_key, h_val = hdr.split("=", 1)
|
||||
h_val = to_native(Header(h_val, charset))
|
||||
h_val = to_native(Header(h_val, charset)) # TODO: use str() instead?
|
||||
msg.add_header(h_key, h_val)
|
||||
except Exception:
|
||||
module.warn(f"Skipping header '{hdr}', unable to parse")
|
||||
|
|
|
|||
|
|
@ -274,7 +274,7 @@ except ImportError:
|
|||
|
||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||
from ansible.module_utils.urls import fetch_url
|
||||
from ansible.module_utils.common.text.converters import to_bytes, to_native, to_text
|
||||
from ansible.module_utils.common.text.converters import to_bytes, to_text
|
||||
|
||||
|
||||
def split_pre_existing_dir(dirname):
|
||||
|
|
@ -601,7 +601,7 @@ class MavenDownloader:
|
|||
errors="strict",
|
||||
)
|
||||
except UnicodeError as e:
|
||||
return f"Cannot retrieve a valid {checksum_alg} checksum from {remote_url}: {to_native(e)}"
|
||||
return f"Cannot retrieve a valid {checksum_alg} checksum from {remote_url}: {e}"
|
||||
if not remote_checksum:
|
||||
return f"Cannot find {checksum_alg} checksum from {remote_url}"
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ class OnePasswordInfo:
|
|||
rc, out, err = self._run(args, command_input=to_bytes(self.auto_login["master_password"]))
|
||||
self.token = out.strip()
|
||||
except AnsibleModuleError as e:
|
||||
module.fail_json(msg=f"Failed to perform initial sign in to 1Password: {to_native(e)}")
|
||||
module.fail_json(msg=f"Failed to perform initial sign in to 1Password: {e}")
|
||||
else:
|
||||
module.fail_json(
|
||||
msg=f"Unable to perform an initial sign in to 1Password. Please run '{self.cli_path} signin' "
|
||||
|
|
|
|||
|
|
@ -171,7 +171,6 @@ description:
|
|||
import uuid
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule, env_fallback
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
HAS_PACKET_SDK = True
|
||||
|
||||
|
|
@ -307,7 +306,7 @@ def main():
|
|||
try:
|
||||
module.exit_json(**act_on_volume(state, module, packet_conn))
|
||||
except Exception as e:
|
||||
module.fail_json(msg=f"failed to set volume state {state}: {to_native(e)}")
|
||||
module.fail_json(msg=f"failed to set volume state {state}: {e}")
|
||||
else:
|
||||
module.fail_json(msg=f"{state} is not a valid state for this module")
|
||||
|
||||
|
|
|
|||
|
|
@ -1056,7 +1056,7 @@ def main():
|
|||
# execute only if we find a System resource
|
||||
result = rf_utils._find_systems_resource()
|
||||
if result["ret"] is False:
|
||||
module.fail_json(msg=to_native(result["msg"]))
|
||||
module.fail_json(msg=result["msg"])
|
||||
|
||||
for command in command_list:
|
||||
if command.startswith("Power"):
|
||||
|
|
@ -1082,7 +1082,7 @@ def main():
|
|||
elif category == "Chassis":
|
||||
result = rf_utils._find_chassis_resource()
|
||||
if result["ret"] is False:
|
||||
module.fail_json(msg=to_native(result["msg"]))
|
||||
module.fail_json(msg=result["msg"])
|
||||
|
||||
led_commands = ["IndicatorLedOn", "IndicatorLedOff", "IndicatorLedBlink"]
|
||||
|
||||
|
|
@ -1113,7 +1113,7 @@ def main():
|
|||
# execute only if we find a Manager service resource
|
||||
result = rf_utils._find_managers_resource()
|
||||
if result["ret"] is False:
|
||||
module.fail_json(msg=to_native(result["msg"]))
|
||||
module.fail_json(msg=result["msg"])
|
||||
|
||||
for command in command_list:
|
||||
# standardize on the Power* commands, but allow the legacy
|
||||
|
|
|
|||
|
|
@ -521,7 +521,7 @@ def main():
|
|||
# execute only if we find a System resource
|
||||
result = rf_utils._find_systems_resource()
|
||||
if result["ret"] is False:
|
||||
module.fail_json(msg=to_native(result["msg"]))
|
||||
module.fail_json(msg=result["msg"])
|
||||
|
||||
for command in command_list:
|
||||
if command == "SetBiosDefaultSettings":
|
||||
|
|
@ -547,7 +547,7 @@ def main():
|
|||
# execute only if we find a Manager service resource
|
||||
result = rf_utils._find_managers_resource()
|
||||
if result["ret"] is False:
|
||||
module.fail_json(msg=to_native(result["msg"]))
|
||||
module.fail_json(msg=result["msg"])
|
||||
|
||||
for command in command_list:
|
||||
if command == "SetNetworkProtocols":
|
||||
|
|
@ -563,7 +563,7 @@ def main():
|
|||
# execute only if we find a Sessions resource
|
||||
result = rf_utils._find_sessionservice_resource()
|
||||
if result["ret"] is False:
|
||||
module.fail_json(msg=to_native(result["msg"]))
|
||||
module.fail_json(msg=result["msg"])
|
||||
|
||||
for command in command_list:
|
||||
if command == "SetSessionService":
|
||||
|
|
|
|||
|
|
@ -101,7 +101,6 @@ RETURN = r"""
|
|||
|
||||
import json
|
||||
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.urls import fetch_url
|
||||
|
||||
|
|
@ -129,7 +128,7 @@ def query(module, url, check, subscription):
|
|||
module.fail_json(msg="Failed to query silence %s. Reason: %s" % (subscription, info))
|
||||
|
||||
try:
|
||||
json_out = json.loads(to_native(response.read()))
|
||||
json_out = json.loads(response.read())
|
||||
except Exception:
|
||||
json_out = ""
|
||||
|
||||
|
|
@ -176,7 +175,7 @@ def clear(module, url, check, subscription):
|
|||
module.fail_json(msg="Failed to silence %s. Reason: %s" % (subscription, info))
|
||||
|
||||
try:
|
||||
json_out = json.loads(to_native(response.read()))
|
||||
json_out = json.loads(response.read())
|
||||
except Exception:
|
||||
json_out = ""
|
||||
|
||||
|
|
@ -225,7 +224,7 @@ def create(module, url, check, creator, expire, expire_on_resolve, reason, subsc
|
|||
module.fail_json(msg="Failed to silence %s. Reason: %s" % (subscription, info["msg"]))
|
||||
|
||||
try:
|
||||
json_out = json.loads(to_native(response.read()))
|
||||
json_out = json.loads(response.read())
|
||||
except Exception:
|
||||
json_out = ""
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,6 @@ import re
|
|||
import traceback
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
|
||||
def _load_dist_subclass(cls, *args, **kwargs):
|
||||
|
|
@ -159,7 +158,7 @@ class Svc:
|
|||
try:
|
||||
os.symlink(self.src_full, self.svc_full)
|
||||
except OSError as e:
|
||||
self.module.fail_json(path=self.src_full, msg=f"Error while linking: {to_native(e)}")
|
||||
self.module.fail_json(path=self.src_full, msg=f"Error while linking: {e}")
|
||||
else:
|
||||
self.module.fail_json(msg=f"Could not find source for service to enable ({self.src_full}).")
|
||||
|
||||
|
|
|
|||
|
|
@ -290,7 +290,7 @@ def main():
|
|||
elif category == "Chassis":
|
||||
result = rf_utils._find_chassis_resource()
|
||||
if result["ret"] is False:
|
||||
module.fail_json(msg=to_native(result["msg"]))
|
||||
module.fail_json(msg=result["msg"])
|
||||
|
||||
led_commands = ["IndicatorLedOn", "IndicatorLedOff"]
|
||||
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ def main():
|
|||
# Check that Category is valid
|
||||
if category not in CATEGORY_COMMANDS_ALL:
|
||||
module.fail_json(
|
||||
msg=to_native(f"Invalid Category '{category}'. Valid Categories = {sorted(CATEGORY_COMMANDS_ALL.keys())}")
|
||||
msg=f"Invalid Category '{category}'. Valid Categories = {sorted(CATEGORY_COMMANDS_ALL.keys())}"
|
||||
)
|
||||
|
||||
# Check that all commands are valid
|
||||
|
|
@ -192,7 +192,9 @@ def main():
|
|||
if command == "SimpleUpdateStatus":
|
||||
simple_update_status_result = rf_utils.get_simple_update_status()
|
||||
if simple_update_status_result["ret"] is False:
|
||||
module.fail_json(msg=to_native(result["msg"]))
|
||||
module.fail_json(
|
||||
msg=to_native(result["msg"])
|
||||
) # TODO result=={}, maybe simple_update_status_result?
|
||||
else:
|
||||
del simple_update_status_result["ret"]
|
||||
result["simple_update_status"] = simple_update_status_result
|
||||
|
|
|
|||
|
|
@ -748,11 +748,11 @@ def main():
|
|||
# For virtual media resource locates on Systems service
|
||||
result = rf_utils._find_systems_resource()
|
||||
if result["ret"] is False:
|
||||
module.fail_json(msg=to_native(result["msg"]))
|
||||
module.fail_json(msg=result["msg"])
|
||||
# For virtual media resource locates on Managers service
|
||||
result = rf_utils._find_managers_resource()
|
||||
if result["ret"] is False:
|
||||
module.fail_json(msg=to_native(result["msg"]))
|
||||
module.fail_json(msg=result["msg"])
|
||||
|
||||
for command in command_list:
|
||||
if command == "VirtualMediaInsert":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue