summaryrefslogtreecommitdiffstats
path: root/lib/ansible/playbook/helpers.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:55:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:55:42 +0000
commit62d9962ec7d01c95bf5732169320d3857a41446e (patch)
treef60d8fc63ff738e5f5afec48a84cf41480ee1315 /lib/ansible/playbook/helpers.py
parentReleasing progress-linux version 2.14.13-1~progress7.99u1. (diff)
downloadansible-core-62d9962ec7d01c95bf5732169320d3857a41446e.tar.xz
ansible-core-62d9962ec7d01c95bf5732169320d3857a41446e.zip
Merging upstream version 2.16.5.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib/ansible/playbook/helpers.py')
-rw-r--r--lib/ansible/playbook/helpers.py36
1 files changed, 6 insertions, 30 deletions
diff --git a/lib/ansible/playbook/helpers.py b/lib/ansible/playbook/helpers.py
index ff5042a..903dcdf 100644
--- a/lib/ansible/playbook/helpers.py
+++ b/lib/ansible/playbook/helpers.py
@@ -21,9 +21,8 @@ __metaclass__ = type
import os
from ansible import constants as C
-from ansible.errors import AnsibleParserError, AnsibleUndefinedVariable, AnsibleFileNotFound, AnsibleAssertionError
-from ansible.module_utils._text import to_native
-from ansible.module_utils.six import string_types
+from ansible.errors import AnsibleParserError, AnsibleUndefinedVariable, AnsibleAssertionError
+from ansible.module_utils.common.text.converters import to_native
from ansible.parsing.mod_args import ModuleArgsParser
from ansible.utils.display import Display
@@ -151,23 +150,9 @@ def load_list_of_tasks(ds, play, block=None, role=None, task_include=None, use_h
templar = Templar(loader=loader, variables=all_vars)
# check to see if this include is dynamic or static:
- # 1. the user has set the 'static' option to false or true
- # 2. one of the appropriate config options was set
- if action in C._ACTION_INCLUDE_TASKS:
- is_static = False
- elif action in C._ACTION_IMPORT_TASKS:
- is_static = True
- else:
- include_link = get_versioned_doclink('user_guide/playbooks_reuse_includes.html')
- display.deprecated('"include" is deprecated, use include_tasks/import_tasks instead. See %s for details' % include_link, "2.16")
- is_static = not templar.is_template(t.args['_raw_params']) and t.all_parents_static() and not t.loop
-
- if is_static:
+ if action in C._ACTION_IMPORT_TASKS:
if t.loop is not None:
- if action in C._ACTION_IMPORT_TASKS:
- raise AnsibleParserError("You cannot use loops on 'import_tasks' statements. You should use 'include_tasks' instead.", obj=task_ds)
- else:
- raise AnsibleParserError("You cannot use 'static' on an include with a loop", obj=task_ds)
+ raise AnsibleParserError("You cannot use loops on 'import_tasks' statements. You should use 'include_tasks' instead.", obj=task_ds)
# we set a flag to indicate this include was static
t.statically_loaded = True
@@ -289,18 +274,9 @@ def load_list_of_tasks(ds, play, block=None, role=None, task_include=None, use_h
loader=loader,
)
- # 1. the user has set the 'static' option to false or true
- # 2. one of the appropriate config options was set
- is_static = False
if action in C._ACTION_IMPORT_ROLE:
- is_static = True
-
- if is_static:
if ir.loop is not None:
- if action in C._ACTION_IMPORT_ROLE:
- raise AnsibleParserError("You cannot use loops on 'import_role' statements. You should use 'include_role' instead.", obj=task_ds)
- else:
- raise AnsibleParserError("You cannot use 'static' on an include_role with a loop", obj=task_ds)
+ raise AnsibleParserError("You cannot use loops on 'import_role' statements. You should use 'include_role' instead.", obj=task_ds)
# we set a flag to indicate this include was static
ir.statically_loaded = True
@@ -312,7 +288,7 @@ def load_list_of_tasks(ds, play, block=None, role=None, task_include=None, use_h
ir._role_name = templar.template(ir._role_name)
# uses compiled list from object
- blocks, _ = ir.get_block_list(variable_manager=variable_manager, loader=loader)
+ blocks, dummy = ir.get_block_list(variable_manager=variable_manager, loader=loader)
task_list.extend(blocks)
else:
# passes task object itself for latter generation of list