From 9d5d815b269a56e25cc069aa0ebff56777c37d12 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Thu, 11 Aug 2016 12:23:20 -0500 Subject: Several fixes for 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 --- lib/ansible/playbook/block.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lib/ansible/playbook/block.py') 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 + -- cgit v1.2.1