mirror of
https://github.com/zebrajr/ansible.git
synced 2025-12-06 00:19:48 +01:00
Deprecate strategy plugins (#84728)
* Deprecate strategy plugins. Fixes #84725
This commit is contained in:
parent
e5ec1ee76c
commit
2a3c93f593
|
|
@ -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 """
|
||||
|
|
|
|||
3
test/integration/targets/strategy-external/aliases
Normal file
3
test/integration/targets/strategy-external/aliases
Normal file
|
|
@ -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):
|
||||
...
|
||||
13
test/integration/targets/strategy-external/runme.sh
Executable file
13
test/integration/targets/strategy-external/runme.sh
Executable file
|
|
@ -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…
Reference in New Issue
Block a user