summaryrefslogtreecommitdiff
path: root/lib/ansible/playbook/block.py
diff options
context:
space:
mode:
authorJames Cammarata <jimi@sngx.net>2016-08-11 12:23:20 -0500
committerJames Cammarata <jimi@sngx.net>2016-08-11 12:23:20 -0500
commit9d5d815b269a56e25cc069aa0ebff56777c37d12 (patch)
treea3144285bd1691a62cc864a3dd3441b0f5b7affd /lib/ansible/playbook/block.py
parent947877dcce32ed544f1004a167196eb654b5d745 (diff)
downloadansible-fixing_includes.tar.gz
Several fixes for includesfixing_includes
* when including statically, make sure that all parents were also included statically (issue #16990) * properly resolve nested static include paths * print a message when a file is statically included Fixes #16990
Diffstat (limited to 'lib/ansible/playbook/block.py')
-rw-r--r--lib/ansible/playbook/block.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/ansible/playbook/block.py b/lib/ansible/playbook/block.py
index ec6298a2c1..14519d8162 100644
--- a/lib/ansible/playbook/block.py
+++ b/lib/ansible/playbook/block.py
@@ -374,3 +374,19 @@ class Block(Base, Become, Conditional, Taggable):
return self._parent.get_include_params()
else:
return dict()
+
+ def all_parents_static(self):
+ '''
+ Determine if all of the parents of this block were statically loaded
+ or not. Since Task/TaskInclude objects may be in the chain, they simply
+ call their parents all_parents_static() method. Only Block objects in
+ the chain check the statically_loaded value of the parent.
+ '''
+ from ansible.playbook.task_include import TaskInclude
+ if self._parent:
+ if isinstance(self._parent, TaskInclude) and not self._parent.statically_loaded:
+ return False
+ return self._parent.all_parents_static()
+
+ return True
+