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
This commit is contained in:
James Cammarata 2016-08-11 12:23:20 -05:00
parent 854d47826c
commit 1c7e0c73c9
5 changed files with 69 additions and 31 deletions

View file

@ -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