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
pull/16428/head
James Cammarata 9 years ago
parent ac04ffb9b1
commit 3e4755f7e4

@ -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):

@ -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

Loading…
Cancel
Save