Fixing tag logic in v2
This commit is contained in:
parent
4bb37b82c4
commit
b08e35bb8a
3 changed files with 9 additions and 17 deletions
|
@ -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:
|
||||||
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):
|
||||||
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.
|
||||||
|
|
Loading…
Reference in a new issue