Add option to prepend inherited attributes when extending values

Fixes #18483
This commit is contained in:
James Cammarata 2016-11-14 16:29:13 -06:00
commit 435ca620b2
4 changed files with 16 additions and 11 deletions

View file

@ -59,7 +59,7 @@ class Conditional:
if when is None:
when = []
if hasattr(self, '_get_parent_attribute'):
when = self._get_parent_attribute('when', extend=True)
when = self._get_parent_attribute('when', extend=True, prepend=True)
return when
def evaluate_conditional(self, templar, all_vars):
@ -130,5 +130,5 @@ class Conditional:
elif "is defined" in original:
return False
else:
raise AnsibleError("error while evaluating conditional (%s): %s" % (original, e))
raise AnsibleUndefinedVariable("error while evaluating conditional (%s): %s" % (original, e))