summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Cammarata <jimi@sngx.net>2015-11-09 14:51:07 -0500
committerJames Cammarata <jimi@sngx.net>2015-11-09 14:51:07 -0500
commit76ae5775192b03f390df0fd04b14b9d79324a9c5 (patch)
tree0a7840fdf748e698712882f7a9b11c4dbc91bee3
parent937584cd525d1f268989b9094c996d5147bca3e5 (diff)
downloadansible-76ae5775192b03f390df0fd04b14b9d79324a9c5.tar.gz
Ensure environment is inherited properly (task->block/include->play)
-rw-r--r--lib/ansible/playbook/base.py2
-rw-r--r--lib/ansible/playbook/block.py5
-rw-r--r--lib/ansible/playbook/task.py6
3 files changed, 7 insertions, 6 deletions
diff --git a/lib/ansible/playbook/base.py b/lib/ansible/playbook/base.py
index 06681abe76..39a6559235 100644
--- a/lib/ansible/playbook/base.py
+++ b/lib/ansible/playbook/base.py
@@ -442,7 +442,7 @@ class Base:
new_value = [ new_value ]
#return list(set(value + new_value))
- return [i for i,_ in itertools.groupby(value + new_value)]
+ return [i for i,_ in itertools.groupby(value + new_value) if i is not None]
def __getstate__(self):
return self.serialize()
diff --git a/lib/ansible/playbook/block.py b/lib/ansible/playbook/block.py
index 3831ed7600..201e881ef4 100644
--- a/lib/ansible/playbook/block.py
+++ b/lib/ansible/playbook/block.py
@@ -323,8 +323,9 @@ class Block(Base, Become, Conditional, Taggable):
Override for the 'tags' getattr fetcher, used from Base.
'''
environment = self._attributes['environment']
- if environment is None:
- environment = self._get_parent_attribute('environment', extend=True)
+ parent_environment = self._get_parent_attribute('environment', extend=True)
+ if parent_environment is not None:
+ environment = self._extend_value(environment, parent_environment)
return environment
diff --git a/lib/ansible/playbook/task.py b/lib/ansible/playbook/task.py
index 8c288fc1d4..8a3d4c4a60 100644
--- a/lib/ansible/playbook/task.py
+++ b/lib/ansible/playbook/task.py
@@ -383,8 +383,8 @@ class Task(Base, Conditional, Taggable, Become):
Override for the 'tags' getattr fetcher, used from Base.
'''
environment = self._attributes['environment']
- if environment is None:
- environment = self._get_parent_attribute('environment')
-
+ parent_environment = self._get_parent_attribute('environment', extend=True)
+ if parent_environment is not None:
+ environment = self._extend_value(environment, parent_environment)
return environment