1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Remove unnecessary role initialization and lookup stuff

* Remove unnecessary copying of values from parents to role deps, as
  this can cause problems when roles have multiple parents (or the same
  parents with different params speficied through deps)
* Since we're already checking the dep chain in the block for role
  things (which every task in a role should have), it is not necessary
  to check the role directly in case it improperly grabs something

Fixes #14438
This commit is contained in:
James Cammarata 2016-06-23 16:46:16 -05:00
parent ac04ffb9b1
commit 3e4755f7e4
2 changed files with 0 additions and 13 deletions

View file

@ -269,9 +269,6 @@ class Block(Base, Become, Conditional, Taggable):
if self._parent_block is not None: if self._parent_block is not None:
if not self._parent_block.evaluate_conditional(templar, all_vars): if not self._parent_block.evaluate_conditional(templar, all_vars):
return False return False
elif self._role is not None:
if not self._role.evaluate_conditional(templar, all_vars):
return False
return super(Block, self).evaluate_conditional(templar, all_vars) return super(Block, self).evaluate_conditional(templar, all_vars)
def set_loader(self, loader): def set_loader(self, loader):

View file

@ -118,16 +118,6 @@ class Role(Base, Become, Conditional, Taggable):
if role_include.role not in play.ROLE_CACHE: if role_include.role not in play.ROLE_CACHE:
play.ROLE_CACHE[role_include.role] = dict() play.ROLE_CACHE[role_include.role] = dict()
if parent_role:
if parent_role.when:
new_when = parent_role.when[:]
new_when.extend(r.when or [])
r.when = new_when
if parent_role.tags:
new_tags = parent_role.tags[:]
new_tags.extend(r.tags or [])
r.tags = new_tags
play.ROLE_CACHE[role_include.role][hashed_params] = r play.ROLE_CACHE[role_include.role][hashed_params] = r
return r return r