Deprecate strategy plugins (#84728)

* Deprecate strategy plugins. Fixes #84725
pull/84735/head
Matt Martz 10 months ago committed by GitHub
parent e5ec1ee76c
commit 2a3c93f593
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,2 @@
deprecated_features:
- Stategy Plugins - Use of strategy plugins not provided in ``ansible.builtin`` are deprecated and do not carry any backwards compatibility guarantees going forward. A future release will remove the ability to use external strategy plugins. No alternative for third party strategy plugins is currently planned.

@ -861,7 +861,16 @@ class PluginLoader:
setattr(obj, 'ansible_name', names[0])
def get(self, name, *args, **kwargs):
return self.get_with_context(name, *args, **kwargs).object
ctx = self.get_with_context(name, *args, **kwargs)
is_core_plugin = ctx.plugin_load_context.plugin_resolved_collection == 'ansible.builtin'
if self.class_name == 'StrategyModule' and not is_core_plugin:
display.deprecated( # pylint: disable=ansible-deprecated-no-version
'Use of strategy plugins not included in ansible.builtin are deprecated and do not carry '
'any backwards compatibility guarantees. No alternative for third party strategy plugins '
'is currently planned.'
)
return ctx.object
def get_with_context(self, name, *args, **kwargs):
""" instantiates a plugin of the given name using arguments """

@ -0,0 +1,3 @@
shippable/posix/group5
context/controller
needs/target/collection

@ -0,0 +1,7 @@
from __future__ import annotations
from ansible.plugins.strategy.linear import StrategyModule as LinearStrategy
class StrategyModule(LinearStrategy):
...

@ -0,0 +1,13 @@
#!/usr/bin/env bash
source ../collection/setup.sh
set -eux
export ANSIBLE_DEPRECATION_WARNINGS=1
export ANSIBLE_COLLECTIONS_PATH="${WORK_DIR}"
export ANSIBLE_STRATEGY=ns.col.external
output="$(ansible localhost -m debug 2>&1 | tee -a /dev/stderr)"
if [[ "${output}" != *"Use of strategy plugins not included in ansible.builtin"* ]]; then
echo 'ERROR: Did not find deprecation warning for removal of strategy plugins'
exit 1
fi
Loading…
Cancel
Save