1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-04-12 15:05:07 +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

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