Fix a couple start-at-task issues

* added pattern matching to match v1 functionality
* check the task name, not the task+role name for matches
* make sure the input is unicode

Fixes #11692
pull/11699/head
James Cammarata 9 years ago
parent 975172c1ef
commit 135404738e

@ -19,6 +19,8 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
import fnmatch
from ansible import constants as C from ansible import constants as C
from ansible.errors import * from ansible.errors import *
@ -108,10 +110,10 @@ class PlayIterator:
(s, task) = self.get_next_task_for_host(host, peek=True) (s, task) = self.get_next_task_for_host(host, peek=True)
if s.run_state == self.ITERATING_COMPLETE: if s.run_state == self.ITERATING_COMPLETE:
break break
if task.get_name() != play_context.start_at_task: if task.name == play_context.start_at_task or fnmatch.fnmatch(task.name, play_context.start_at_task):
self.get_next_task_for_host(host)
else:
break break
else:
self.get_next_task_for_host(host)
# Extend the play handlers list to include the handlers defined in roles # Extend the play handlers list to include the handlers defined in roles
self._play.handlers.extend(play.compile_roles_handlers()) self._play.handlers.extend(play.compile_roles_handlers())

@ -31,6 +31,7 @@ from ansible.playbook.attribute import Attribute, FieldAttribute
from ansible.playbook.base import Base from ansible.playbook.base import Base
from ansible.template import Templar from ansible.template import Templar
from ansible.utils.boolean import boolean from ansible.utils.boolean import boolean
from ansible.utils.unicode import to_unicode
__all__ = ['PlayContext'] __all__ = ['PlayContext']
@ -251,7 +252,7 @@ class PlayContext(Base):
if hasattr(options, 'step') and options.step: if hasattr(options, 'step') and options.step:
self.step = boolean(options.step) self.step = boolean(options.step)
if hasattr(options, 'start_at_task') and options.start_at_task: if hasattr(options, 'start_at_task') and options.start_at_task:
self.start_at_task = options.start_at_task self.start_at_task = to_unicode(options.start_at_task)
# get the tag info from options, converting a comma-separated list # get the tag info from options, converting a comma-separated list
# of values into a proper list if need be. We check to see if the # of values into a proper list if need be. We check to see if the

Loading…
Cancel
Save