mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-21 03:23:59 -07:00
remove Python2 some constructs/docs/comments (#10892)
Some checks are pending
EOL CI / EOL Sanity (Ⓐ2.17) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.17+py3.10) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.17+py3.12) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.17+py3.7) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+alpine319+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+alpine319+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+alpine319+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+fedora39+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+fedora39+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+fedora39+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+ubuntu2004+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+ubuntu2004+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+ubuntu2004+py:azp/posix/3/) (push) Waiting to run
nox / Run extra sanity tests (push) Waiting to run
Some checks are pending
EOL CI / EOL Sanity (Ⓐ2.17) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.17+py3.10) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.17+py3.12) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.17+py3.7) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+alpine319+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+alpine319+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+alpine319+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+fedora39+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+fedora39+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+fedora39+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+ubuntu2004+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+ubuntu2004+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+ubuntu2004+py:azp/posix/3/) (push) Waiting to run
nox / Run extra sanity tests (push) Waiting to run
* 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
7
changelogs/fragments/10892-remove-py2.yml
Normal file
7
changelogs/fragments/10892-remove-py2.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
minor_changes:
|
||||
- known_hosts module_utils - drop Python 2 support when parsing output of ``urlparse`` (https://github.com/ansible-collections/community.general/pull/10892).
|
||||
- aix_inittab - drop Python 2 support for function ``zip`` (https://github.com/ansible-collections/community.general/pull/10892).
|
||||
- copr - drop support for Python 2 interpreter (https://github.com/ansible-collections/community.general/pull/10892).
|
||||
- dconf - drop support for Python 2 interpreter (https://github.com/ansible-collections/community.general/pull/10892).
|
||||
- irc - drop Python 2 support for SSL context creation (https://github.com/ansible-collections/community.general/pull/10892).
|
||||
- mail - drop Python 2 support for Message-ID domain setting (https://github.com/ansible-collections/community.general/pull/10892).
|
|
@ -60,17 +60,14 @@ def get_fqdn_and_port(repo_url):
|
|||
elif "://" in repo_url:
|
||||
# this should be something we can parse with urlparse
|
||||
parts = urlparse(repo_url)
|
||||
# parts[1] will be empty on python2.4 on ssh:// or git:// urls, so
|
||||
# ensure we actually have a parts[1] before continuing.
|
||||
if parts[1] != '':
|
||||
fqdn = parts[1]
|
||||
if "@" in fqdn:
|
||||
fqdn = fqdn.split("@", 1)[1]
|
||||
match = ipv6_re.match(fqdn)
|
||||
if match:
|
||||
fqdn, port = match.groups()
|
||||
elif ":" in fqdn:
|
||||
fqdn, port = fqdn.split(":")[0:2]
|
||||
fqdn = parts[1]
|
||||
if "@" in fqdn:
|
||||
fqdn = fqdn.split("@", 1)[1]
|
||||
match = ipv6_re.match(fqdn)
|
||||
if match:
|
||||
fqdn, port = match.groups()
|
||||
elif ":" in fqdn:
|
||||
fqdn, port = fqdn.split(":")[0:2]
|
||||
return fqdn, port
|
||||
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -15,7 +15,7 @@ from ansible_collections.community.internal_test_tools.tests.unit.plugins.module
|
|||
|
||||
from pytest import importorskip
|
||||
|
||||
# Skip this test if python 2 so datadog_api_client cannot be installed
|
||||
# Skip this test if datadog_api_client cannot be installed
|
||||
datadog_api_client = importorskip("datadog_api_client")
|
||||
Downtime = datadog_api_client.v1.model.downtime.Downtime
|
||||
DowntimeRecurrence = datadog_api_client.v1.model.downtime_recurrence.DowntimeRecurrence
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue