mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-28 03:00:23 -07:00
We have had only_if, when_foo, etc, deprecated for a while and said they would be removed in 1.5. Now they are, with friendly error messages still.
Users of these features should use "when:" as documented at docs.ansible.com. Similarly, include + with_items has been removed. The solution is to loop inside the task files, see with_nested / with_together, etc.
This commit is contained in:
parent
5d50bcf6dc
commit
28b9fd4e30
4 changed files with 18 additions and 14 deletions
|
@ -484,14 +484,9 @@ class Play(object):
|
|||
include_vars = {}
|
||||
for k in x:
|
||||
if k.startswith("with_"):
|
||||
utils.deprecated("include + with_items is an unsupported feature and has been undocumented for many releases because of this", "1.5")
|
||||
plugin_name = k[5:]
|
||||
if plugin_name not in utils.plugins.lookup_loader:
|
||||
raise errors.AnsibleError("cannot find lookup plugin named %s for usage in with_%s" % (plugin_name, plugin_name))
|
||||
terms = template(self.basedir, x[k], task_vars)
|
||||
items = utils.plugins.lookup_loader.get(plugin_name, basedir=self.basedir, runner=None).run(terms, inject=task_vars)
|
||||
utils.deprecated("include + with_items is a removed deprecated feature", "1.5", removed=True)
|
||||
elif k.startswith("when_"):
|
||||
included_additional_conditions.insert(0, utils.compile_when_to_only_if("%s %s" % (k[5:], x[k])))
|
||||
utils.deprecated("\"when_<criteria>:\" is a removed deprecated feature, use the simplified 'when:' conditional directly", None, removed=True)
|
||||
elif k == 'when':
|
||||
if type(x[k]) is str:
|
||||
included_additional_conditions.insert(0, utils.compile_when_to_only_if("jinja2_compare %s" % x[k]))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue