diff options
author | James Cammarata <jimi@sngx.net> | 2015-06-22 01:17:09 -0400 |
---|---|---|
committer | James Cammarata <jimi@sngx.net> | 2015-06-24 20:57:53 -0400 |
commit | 332ca927d96cdae40110454a16ba041b008de6c8 (patch) | |
tree | d924ce5362c0ab31c452ac263f8ac2b1870869fe | |
parent | 256a323de56d8259c9cd65ae4c55ab761d432b85 (diff) | |
download | ansible-332ca927d96cdae40110454a16ba041b008de6c8.tar.gz |
Fix parent attribute lookup
Using 'value is None' instead of 'not value', in order to account
for boolean values which may be false
Fixes #11232
-rw-r--r-- | lib/ansible/playbook/block.py | 11 | ||||
-rw-r--r-- | lib/ansible/playbook/task.py | 4 |
2 files changed, 8 insertions, 7 deletions
diff --git a/lib/ansible/playbook/block.py b/lib/ansible/playbook/block.py index a82aae1e67..57a22c8cc1 100644 --- a/lib/ansible/playbook/block.py +++ b/lib/ansible/playbook/block.py @@ -260,19 +260,19 @@ class Block(Base, Become, Conditional, Taggable): ''' value = self._attributes[attr] - if self._parent_block and (not value or extend): + if self._parent_block and (value is None or extend): parent_value = getattr(self._parent_block, attr) if extend: value = self._extend_value(value, parent_value) else: value = parent_value - if self._task_include and (not value or extend): + if self._task_include and (value is None or extend): parent_value = getattr(self._task_include, attr) if extend: value = self._extend_value(value, parent_value) else: value = parent_value - if self._role and (not value or extend): + if self._role and (value is None or extend): parent_value = getattr(self._role, attr) if extend: value = self._extend_value(value, parent_value) @@ -289,9 +289,10 @@ class Block(Base, Become, Conditional, Taggable): else: value = dep_value - if value and not extend: + if value is not None and not extend: break - if self._play and (not value or extend): + + if self._play and (value is None or extend): parent_value = getattr(self._play, attr) if extend: value = self._extend_value(value, parent_value) diff --git a/lib/ansible/playbook/task.py b/lib/ansible/playbook/task.py index 1570173f42..f0a7350954 100644 --- a/lib/ansible/playbook/task.py +++ b/lib/ansible/playbook/task.py @@ -297,13 +297,13 @@ class Task(Base, Conditional, Taggable, Become): Generic logic to get the attribute or parent attribute for a task value. ''' value = self._attributes[attr] - if self._block and (not value or extend): + if self._block and (value is None or extend): parent_value = getattr(self._block, attr) if extend: value = self._extend_value(value, parent_value) else: value = parent_value - if self._task_include and (not value or extend): + if self._task_include and (value is None or extend): parent_value = getattr(self._task_include, attr) if extend: value = self._extend_value(value, parent_value) |