mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42: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:
@@ -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}")
|
||||
|
||||
Reference in New Issue
Block a user