mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-05 03:37:01 +00:00
remove Python2 some constructs/docs/comments (#10892)
* remove Python2 some constructs/docs/comments * add changelog frag
This commit is contained in:
parent
5f471b8e5b
commit
633bd6133a
12 changed files with 22 additions and 47 deletions
|
|
@ -114,12 +114,6 @@ name:
|
|||
sample: startmyservice
|
||||
"""
|
||||
|
||||
# Import necessary libraries
|
||||
try:
|
||||
# python 2
|
||||
from itertools import izip
|
||||
except ImportError:
|
||||
izip = zip
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
|
@ -138,7 +132,7 @@ def check_current_entry(module):
|
|||
values = out.split(":")
|
||||
# strip non readable characters as \n
|
||||
values = map(lambda s: s.strip(), values)
|
||||
existsdict = dict(izip(keys, values))
|
||||
existsdict = dict(zip(keys, values))
|
||||
existsdict.update({'exist': True})
|
||||
return existsdict
|
||||
|
||||
|
|
|
|||
|
|
@ -56,8 +56,6 @@ author:
|
|||
todo:
|
||||
notes:
|
||||
- Concurrently syncing Cobbler is bound to fail with weird errors.
|
||||
- On Python 2.7.8 and older (such as RHEL7) you may need to tweak the Python behaviour to disable certificate validation.
|
||||
More information at L(Certificate verification in Python standard library HTTP clients,https://access.redhat.com/articles/2039753).
|
||||
"""
|
||||
|
||||
EXAMPLES = r"""
|
||||
|
|
|
|||
|
|
@ -79,8 +79,6 @@ author:
|
|||
- Dag Wieers (@dagwieers)
|
||||
notes:
|
||||
- Concurrently syncing Cobbler is bound to fail with weird errors.
|
||||
- On Python 2.7.8 and older (such as RHEL7) you may need to tweak the Python behaviour to disable certificate validation.
|
||||
More information at L(Certificate verification in Python standard library HTTP clients,https://access.redhat.com/articles/2039753).
|
||||
"""
|
||||
|
||||
EXAMPLES = r"""
|
||||
|
|
|
|||
|
|
@ -129,7 +129,6 @@ def _respawn_dnf():
|
|||
system_interpreters = (
|
||||
"/usr/libexec/platform-python",
|
||||
"/usr/bin/python3",
|
||||
"/usr/bin/python2",
|
||||
"/usr/bin/python",
|
||||
)
|
||||
interpreter = respawn.probe_interpreters_for_module(system_interpreters, "dnf")
|
||||
|
|
|
|||
|
|
@ -421,8 +421,7 @@ def main():
|
|||
msg="%s must be installed and visible from %s." %
|
||||
(glib_module_name, sys.executable))
|
||||
|
||||
interpreters = ['/usr/bin/python3', '/usr/bin/python2',
|
||||
'/usr/bin/python']
|
||||
interpreters = ['/usr/bin/python3', '/usr/bin/python']
|
||||
|
||||
interpreter = probe_interpreters_for_module(
|
||||
interpreters, glib_module_name)
|
||||
|
|
|
|||
|
|
@ -92,8 +92,6 @@ requirements:
|
|||
- PyGithub>=1.54
|
||||
notes:
|
||||
- For Python 3, PyGithub>=1.54 should be used.
|
||||
- 'For Python 3.5, PyGithub==1.54 should be used. More information: U(https://pygithub.readthedocs.io/en/latest/changes.html#version-1-54-november-30-2020).'
|
||||
- 'For Python 2.7, PyGithub==1.45 should be used. More information: U(https://pygithub.readthedocs.io/en/latest/changes.html#version-1-45-december-29-2019).'
|
||||
author:
|
||||
- Álvaro Torres Cogollo (@atorrescogollo)
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -234,17 +234,10 @@ def send_msg(msg, server='localhost', port='6667', channel=None, nick_to=None, k
|
|||
if use_tls:
|
||||
kwargs = {}
|
||||
if validate_certs:
|
||||
try:
|
||||
context = ssl.create_default_context()
|
||||
kwargs["server_hostname"] = server
|
||||
except AttributeError:
|
||||
raise Exception('Need at least Python 2.7.9 for SSL certificate validation')
|
||||
context = ssl.create_default_context()
|
||||
kwargs["server_hostname"] = server
|
||||
else:
|
||||
if getattr(ssl, 'PROTOCOL_TLS', None) is not None:
|
||||
# Supported since Python 2.7.13
|
||||
context = ssl.SSLContext(ssl.PROTOCOL_TLS)
|
||||
else:
|
||||
context = ssl.SSLContext()
|
||||
context = ssl.SSLContext(ssl.PROTOCOL_TLS)
|
||||
context.verify_mode = ssl.CERT_NONE
|
||||
irc = context.wrap_socket(irc, **kwargs)
|
||||
irc.connect((server, int(port)))
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -174,8 +174,6 @@ options:
|
|||
requirements:
|
||||
- softlayer >= 4.1.1
|
||||
notes:
|
||||
- If using Python 2.7, you must install C(softlayer-python<=5.7.2).
|
||||
- If using Python 3.6, you must install C(softlayer-python<=6.0.0).
|
||||
- The C(softlayer-python) library, at version 6.2.6 (from Jan 2025), only supports Python version 3.8, 3.9 and 3.10.
|
||||
author:
|
||||
- Matt Colton (@mcltn)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue