Drop support for ansible-core 2.11 and 2.12 (#7269)

* Drop support for ansible-core 2.11 and 2.12.

Also move ansible-core 2.13 from regular CI to EOL CI.

* Remove some compatibility code.

* Remove no longer needed import.

* Update README.

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>

---------

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
Felix Fontein 2023-10-11 16:13:14 +02:00 committed by GitHub
parent 91fdc8e06a
commit 4ea40e9473
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 29 additions and 148 deletions

View file

@ -44,26 +44,17 @@ from ansible import constants as C
from ansible.plugins.callback import CallbackBase
from ansible.module_utils.common.text.converters import to_text
try:
codeCodes = C.COLOR_CODES
except AttributeError:
# This constant was moved to ansible.constants in
# https://github.com/ansible/ansible/commit/1202dd000f10b0e8959019484f1c3b3f9628fc67
# (will be included in ansible-core 2.11.0). For older Ansible/ansible-base versions,
# we include from the original location.
from ansible.utils.color import codeCodes
DONT_COLORIZE = False
COLORS = {
'normal': '\033[0m',
'ok': '\033[{0}m'.format(codeCodes[C.COLOR_OK]),
'ok': '\033[{0}m'.format(C.COLOR_CODES[C.COLOR_OK]),
'bold': '\033[1m',
'not_so_bold': '\033[1m\033[34m',
'changed': '\033[{0}m'.format(codeCodes[C.COLOR_CHANGED]),
'failed': '\033[{0}m'.format(codeCodes[C.COLOR_ERROR]),
'changed': '\033[{0}m'.format(C.COLOR_CODES[C.COLOR_CHANGED]),
'failed': '\033[{0}m'.format(C.COLOR_CODES[C.COLOR_ERROR]),
'endc': '\033[0m',
'skipped': '\033[{0}m'.format(codeCodes[C.COLOR_SKIP]),
'skipped': '\033[{0}m'.format(C.COLOR_CODES[C.COLOR_SKIP]),
}

View file

@ -98,15 +98,10 @@ def load_collection_meta(collection_pkg, no_version='*'):
if os.path.exists(manifest_path):
return load_collection_meta_manifest(manifest_path)
# Try to load galaxy.y(a)ml
# Try to load galaxy.yml
galaxy_path = os.path.join(path, 'galaxy.yml')
galaxy_alt_path = os.path.join(path, 'galaxy.yaml')
# galaxy.yaml was only supported in ansible-base 2.10 and ansible-core 2.11. Support was removed
# in https://github.com/ansible/ansible/commit/595413d11346b6f26bb3d9df2d8e05f2747508a3 for
# ansible-core 2.12.
for path in (galaxy_path, galaxy_alt_path):
if os.path.exists(path):
return load_collection_meta_galaxy(path, no_version=no_version)
if os.path.exists(galaxy_path):
return load_collection_meta_galaxy(galaxy_path, no_version=no_version)
return {}

View file

@ -10,13 +10,4 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.module_utils.six import raise_from
try:
from ansible.module_utils.compat.version import LooseVersion # noqa: F401, pylint: disable=unused-import
except ImportError:
try:
from distutils.version import LooseVersion # noqa: F401, pylint: disable=unused-import
except ImportError as exc:
msg = 'To use this plugin or module with ansible-core 2.11, you need to use Python < 3.12 with distutils.version present'
raise_from(ImportError(msg), exc)
from ansible.module_utils.compat.version import LooseVersion # noqa: F401, pylint: disable=unused-import