Make fact delegating configurable, defaulting to 1.x behavior

This commit is contained in:
James Cammarata 2015-12-08 14:00:17 -05:00
parent 7c8e1b41bb
commit 5ae850c3b2
5 changed files with 6 additions and 2 deletions

View file

@ -34,6 +34,7 @@ class Block(Base, Become, Conditional, Taggable):
_rescue = FieldAttribute(isa='list', default=[])
_always = FieldAttribute(isa='list', default=[])
_delegate_to = FieldAttribute(isa='list')
_delegate_facts = FieldAttribute(isa='bool', defalt=False)
# for future consideration? this would be functionally
# similar to the 'else' clause for exceptions

View file

@ -61,6 +61,7 @@ def hash_params(params):
class Role(Base, Become, Conditional, Taggable):
_delegate_to = FieldAttribute(isa='string')
_delegate_facts = FieldAttribute(isa='bool', defalt=False)
def __init__(self, play=None):
self._role_name = None

View file

@ -40,7 +40,8 @@ class RoleInclude(RoleDefinition):
is included for execution in a play.
"""
_delegate_to = FieldAttribute(isa='string')
_delegate_to = FieldAttribute(isa='string')
_delegate_facts = FieldAttribute(isa='bool', defalt=False)
def __init__(self, play=None, role_basedir=None, variable_manager=None, loader=None):
super(RoleInclude, self).__init__(play=play, role_basedir=role_basedir, variable_manager=variable_manager, loader=loader)

View file

@ -72,6 +72,7 @@ class Task(Base, Conditional, Taggable, Become):
_changed_when = FieldAttribute(isa='string')
_delay = FieldAttribute(isa='int', default=5)
_delegate_to = FieldAttribute(isa='string')
_delegate_facts = FieldAttribute(isa='bool', defalt=False)
_failed_when = FieldAttribute(isa='string')
_first_available_file = FieldAttribute(isa='list')
_loop = FieldAttribute(isa='string', private=True)

View file

@ -289,7 +289,7 @@ class StrategyBase:
# find the host we're actually refering too here, which may
# be a host that is not really in inventory at all
if task.delegate_to is not None:
if task.delegate_to is not None and task.delegate_facts:
task_vars = self._variable_manager.get_vars(loader=self._loader, play=iterator._play, host=host, task=task)
self.add_tqm_variables(task_vars, play=iterator._play)
if item is not None: