1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

ansible_galaxy_install: added deprecation for ansible 2.9 and ansible-base 2.10 (#4601)

* ansible_galaxy_install: added deprecation for ansible 2.9 and ansible-base 2.10

* added changelog fragment

* Update plugins/modules/packaging/language/ansible_galaxy_install.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/packaging/language/ansible_galaxy_install.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/packaging/language/ansible_galaxy_install.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/packaging/language/ansible_galaxy_install.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* ansible29 condition

* Update plugins/modules/packaging/language/ansible_galaxy_install.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/packaging/language/ansible_galaxy_install.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/packaging/language/ansible_galaxy_install.py

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Alexei Znamensky 2022-05-10 15:59:45 +12:00 committed by GitHub
parent 72bffce2fe
commit 73cea82fe7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 1 deletions

View file

@ -0,0 +1,2 @@
deprecated_features:
- ansible_galaxy_install - deprecated support for ``ansible`` 2.9 and ``ansible-base`` 2.10 (https://github.com/ansible-collections/community.general/pull/4601).

View file

@ -70,6 +70,17 @@ options:
description:
- Acknowledge using Ansible 2.9 with its limitations, and prevents the module from generating warnings about them.
- This option is completely ignored if using a version of Ansible greater than C(2.9.x).
- Note that this option will be removed without any further deprecation warning once support
for Ansible 2.9 is removed from this module.
type: bool
default: false
ack_min_ansiblecore211:
description:
- Acknowledge the module is deprecating support for Ansible 2.9 and ansible-base 2.10.
- Support for those versions will be removed in community.general 8.0.0.
At the same time, this option will be removed without any deprecation warning!
- This option is completely ignored if using a version of ansible-core/ansible-base/Ansible greater than C(2.11).
- For the sake of conciseness, setting this parameter to C(true) implies I(ack_ansible29=true).
type: bool
default: false
"""
@ -194,6 +205,7 @@ class AnsibleGalaxyInstall(CmdModuleHelper):
force=dict(type='bool', default=False),
no_deps=dict(type='bool', default=False),
ack_ansible29=dict(type='bool', default=False),
ack_min_ansiblecore211=dict(type='bool', default=False),
),
mutually_exclusive=[('name', 'requirements_file')],
required_one_of=[('name', 'requirements_file')],
@ -226,6 +238,14 @@ class AnsibleGalaxyInstall(CmdModuleHelper):
def __init_module__(self):
self.ansible_version = self._get_ansible_galaxy_version()
if self.ansible_version < (2, 11) and not self.vars.ack_min_ansiblecore211:
self.module.deprecate(
"Support for Ansible 2.9 and ansible-base 2.10 is being deprecated. "
"At the same time support for them is ended, also the ack_ansible29 option will be removed. "
"Upgrading is strongly recommended, or set 'ack_min_ansiblecore211' to supress this message.",
version="8.0.0",
collection_name="community.general",
)
self.is_ansible29 = self.ansible_version < (2, 10)
if self.is_ansible29:
self._RE_INSTALL_OUTPUT = re.compile(r"^(?:.*Installing '(?P<collection>\w+\.\w+):(?P<cversion>[\d\.]+)'.*"
@ -281,7 +301,7 @@ class AnsibleGalaxyInstall(CmdModuleHelper):
self.vars.set("new_collections", {})
self.vars.set("new_roles", {})
self.vars.set("ansible29_change", False, change=True, output=False)
if not self.vars.ack_ansible29:
if not (self.vars.ack_ansible29 or self.vars.ack_min_ansiblecore211):
self.module.warn("Ansible 2.9 or older: unable to retrieve lists of roles and collections already installed")
if self.vars.requirements_file is not None and self.vars.type == 'both':
self.module.warn("Ansible 2.9 or older: will install only roles from requirement files")