1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-03-22 05:09:12 +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:
patchback[bot] 2025-11-16 07:09:40 +01:00 committed by GitHub
parent 15d4fff749
commit 8a7f360558
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 68 additions and 58 deletions

View file

@ -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}")