Commit b08e35bb by James Cammarata

Fixing tag logic in v2

parent 4bb37b82
...@@ -235,17 +235,6 @@ class Block(Base, Become, Conditional, Taggable): ...@@ -235,17 +235,6 @@ class Block(Base, Become, Conditional, Taggable):
return False return False
return super(Block, self).evaluate_conditional(all_vars) return super(Block, self).evaluate_conditional(all_vars)
def evaluate_tags(self, only_tags, skip_tags, all_vars):
result = False
if len(self._dep_chain):
for dep in self._dep_chain:
result |= dep.evaluate_tags(only_tags=only_tags, skip_tags=skip_tags, all_vars=all_vars)
if self._parent_block is not None:
result |= self._parent_block.evaluate_tags(only_tags=only_tags, skip_tags=skip_tags, all_vars=all_vars)
elif self._role is not None:
result |= self._role.evaluate_tags(only_tags=only_tags, skip_tags=skip_tags, all_vars=all_vars)
return result | super(Block, self).evaluate_tags(only_tags=only_tags, skip_tags=skip_tags, all_vars=all_vars)
def set_loader(self, loader): def set_loader(self, loader):
self._loader = loader self._loader = loader
if self._parent_block: if self._parent_block:
......
...@@ -39,6 +39,15 @@ class Taggable: ...@@ -39,6 +39,15 @@ class Taggable:
else: else:
raise AnsibleError('tags must be specified as a list', obj=ds) raise AnsibleError('tags must be specified as a list', obj=ds)
def _get_attr_tags(self):
'''
Override for the 'tags' getattr fetcher, used from Base.
'''
tags = self._attributes['tags']
if hasattr(self, '_get_parent_attribute'):
tags.extend(self._get_parent_attribute('tags'))
return list(set(tags))
def evaluate_tags(self, only_tags, skip_tags, all_vars): def evaluate_tags(self, only_tags, skip_tags, all_vars):
''' this checks if the current item should be executed depending on tag options ''' ''' this checks if the current item should be executed depending on tag options '''
......
...@@ -285,12 +285,6 @@ class Task(Base, Conditional, Taggable, Become): ...@@ -285,12 +285,6 @@ class Task(Base, Conditional, Taggable, Become):
return False return False
return super(Task, self).evaluate_conditional(all_vars) return super(Task, self).evaluate_conditional(all_vars)
def evaluate_tags(self, only_tags, skip_tags, all_vars):
result = False
if self._block is not None:
result |= self._block.evaluate_tags(only_tags=only_tags, skip_tags=skip_tags, all_vars=all_vars)
return result | super(Task, self).evaluate_tags(only_tags=only_tags, skip_tags=skip_tags, all_vars=all_vars)
def set_loader(self, loader): def set_loader(self, loader):
''' '''
Sets the loader on this object and recursively on parent, child objects. Sets the loader on this object and recursively on parent, child objects.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment