diff options
Diffstat (limited to 'lib/ansible/plugins/strategy/linear.py')
-rw-r--r-- | lib/ansible/plugins/strategy/linear.py | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/lib/ansible/plugins/strategy/linear.py b/lib/ansible/plugins/strategy/linear.py index 2fd4cbae..a3c91c29 100644 --- a/lib/ansible/plugins/strategy/linear.py +++ b/lib/ansible/plugins/strategy/linear.py @@ -34,7 +34,7 @@ DOCUMENTATION = ''' from ansible import constants as C from ansible.errors import AnsibleError, AnsibleAssertionError, AnsibleParserError from ansible.executor.play_iterator import IteratingStates, FailedStates -from ansible.module_utils.common.text.converters import to_text +from ansible.module_utils._text import to_text from ansible.playbook.handler import Handler from ansible.playbook.included_file import IncludedFile from ansible.playbook.task import Task @@ -77,7 +77,7 @@ class StrategyModule(StrategyBase): if self._in_handlers and not any(filter( lambda rs: rs == IteratingStates.HANDLERS, - (s.run_state for s, dummy in state_task_per_host.values())) + (s.run_state for s, _ in state_task_per_host.values())) ): self._in_handlers = False @@ -170,9 +170,10 @@ class StrategyModule(StrategyBase): # 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) - if not isinstance(task, Handler) and task._role: - role_obj = self._get_cached_role(task, iterator._play) - if role_obj.has_run(host) and role_obj._metadata.allow_duplicates is False: + if not isinstance(task, Handler) and task._role and task._role.has_run(host): + # If there is no metadata, the default behavior is to not allow duplicates, + # if there is metadata, check to see if the allow_duplicates flag was set to true + if task._role._metadata is None or task._role._metadata and not task._role._metadata.allow_duplicates: display.debug("'%s' skipped because role has already run" % task) continue @@ -242,12 +243,6 @@ class StrategyModule(StrategyBase): self._queue_task(host, task, task_vars, play_context) del task_vars - if isinstance(task, Handler): - if run_once: - task.clear_hosts() - else: - task.remove_host(host) - # if we're bypassing the host loop, break out now if run_once: break @@ -367,7 +362,7 @@ class StrategyModule(StrategyBase): if any_errors_fatal and (len(failed_hosts) > 0 or len(unreachable_hosts) > 0): dont_fail_states = frozenset([IteratingStates.RESCUE, IteratingStates.ALWAYS]) for host in hosts_left: - (s, dummy) = iterator.get_next_task_for_host(host, peek=True) + (s, _) = iterator.get_next_task_for_host(host, peek=True) # the state may actually be in a child state, use the get_active_state() # method in the iterator to figure out the true active state s = iterator.get_active_state(s) |