From 135404738e61e8d9b69e189047c3466134594d4e Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Wed, 22 Jul 2015 07:45:03 -0400 Subject: [PATCH] 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 --- lib/ansible/executor/play_iterator.py | 8 +++++--- lib/ansible/playbook/play_context.py | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/ansible/executor/play_iterator.py b/lib/ansible/executor/play_iterator.py index 07b890c420..833ee86d41 100644 --- a/lib/ansible/executor/play_iterator.py +++ b/lib/ansible/executor/play_iterator.py @@ -19,6 +19,8 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type +import fnmatch + from ansible import constants as C from ansible.errors import * @@ -108,10 +110,10 @@ class PlayIterator: (s, task) = self.get_next_task_for_host(host, peek=True) if s.run_state == self.ITERATING_COMPLETE: break - if task.get_name() != play_context.start_at_task: - self.get_next_task_for_host(host) - else: + if task.name == play_context.start_at_task or fnmatch.fnmatch(task.name, play_context.start_at_task): break + else: + self.get_next_task_for_host(host) # Extend the play handlers list to include the handlers defined in roles self._play.handlers.extend(play.compile_roles_handlers()) diff --git a/lib/ansible/playbook/play_context.py b/lib/ansible/playbook/play_context.py index 762f3ce6cb..8b856310dc 100644 --- a/lib/ansible/playbook/play_context.py +++ b/lib/ansible/playbook/play_context.py @@ -31,6 +31,7 @@ from ansible.playbook.attribute import Attribute, FieldAttribute from ansible.playbook.base import Base from ansible.template import Templar from ansible.utils.boolean import boolean +from ansible.utils.unicode import to_unicode __all__ = ['PlayContext'] @@ -251,7 +252,7 @@ class PlayContext(Base): if hasattr(options, 'step') and options.step: self.step = boolean(options.step) 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 # of values into a proper list if need be. We check to see if the