Handle run_once scenarios in the free strategy

* Raise an error if the action is using BYPASS_HOST_LOOP, to prevent
  unexpected behavior from those actions
* Show a warning regarding tasks marked as run_once, as the free strategy
  does not yet support that behavior
* Minor tweak to linear strategies run_once code to make sure we don't
  raise an error if an action isn't found
This commit is contained in:
James Cammarata 2016-02-05 11:19:50 -05:00
parent 27f9cc05f8
commit c79d9a9c62
2 changed files with 22 additions and 2 deletions

View file

@ -199,7 +199,7 @@ class StrategyModule(StrategyBase):
except KeyError:
# we don't care here, because the action may simply not have a
# corresponding action plugin
pass
action = None
# check to see if this task should be skipped, due to it being a member of a
# role which has already run (and whether that role allows duplicate execution)
@ -227,7 +227,7 @@ class StrategyModule(StrategyBase):
templar = Templar(loader=self._loader, variables=task_vars)
display.debug("done getting variables")
run_once = templar.template(task.run_once) or getattr(action, 'BYPASS_HOST_LOOP', False)
run_once = templar.template(task.run_once) or action and getattr(action, 'BYPASS_HOST_LOOP', False)
if task.any_errors_fatal or run_once:
any_errors_fatal = True