remove Python2 some constructs/docs/comments (#10892)

* remove Python2 some constructs/docs/comments

* add changelog frag
This commit is contained in:
Alexei Znamensky
2025-10-11 06:15:01 +13:00
committed by GitHub
parent 5f471b8e5b
commit 633bd6133a
12 changed files with 22 additions and 47 deletions

View File

@@ -137,7 +137,6 @@ options:
message_id_domain:
description:
- The domain name to use for the L(Message-ID header, https://en.wikipedia.org/wiki/Message-ID).
- Note that this is only available on Python 3+. On Python 2, this value is ignored.
type: str
default: ansible
version_added: 8.2.0
@@ -352,12 +351,7 @@ def main():
msg['From'] = formataddr((sender_phrase, sender_addr))
msg['Date'] = formatdate(localtime=True)
msg['Subject'] = Header(subject, charset)
try:
msg['Message-ID'] = make_msgid(domain=message_id_domain)
except TypeError:
# `domain` is only available in Python 3
msg['Message-ID'] = make_msgid()
module.warn("The Message-ID domain cannot be set on Python 2; the system's hostname is used")
msg['Message-ID'] = make_msgid(domain=message_id_domain)
msg.preamble = "Multipart message"
for header in headers: