Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix --start-at-task when skipping tasks with no name #68951

Merged
merged 4 commits into from Apr 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/68569-start-at-fix.yaml
@@ -0,0 +1,2 @@
bugfixes:
- Using --start-at-task would fail when it attempted to skip over tasks with no name.
2 changes: 1 addition & 1 deletion lib/ansible/executor/play_iterator.py
Expand Up @@ -201,7 +201,7 @@ def __init__(self, inventory, play, play_context, variable_manager, all_vars, st
(s, task) = self.get_next_task_for_host(host, peek=True)
if s.run_state == self.ITERATING_COMPLETE:
break
if task.name == play_context.start_at_task or fnmatch.fnmatch(task.name, play_context.start_at_task) or \
if task.name == play_context.start_at_task or (task.name and fnmatch.fnmatch(task.name, play_context.start_at_task)) or \
task.get_name() == play_context.start_at_task or fnmatch.fnmatch(task.get_name(), play_context.start_at_task):
start_at_matched = True
break
Expand Down
1 change: 1 addition & 0 deletions test/integration/targets/play_iterator/aliases
@@ -0,0 +1 @@
shippable/posix/group4
10 changes: 10 additions & 0 deletions test/integration/targets/play_iterator/playbook.yml
@@ -0,0 +1,10 @@
---
- hosts: localhost
gather_facts: false
tasks:
- name:
debug:
msg: foo
- name: "task 2"
debug:
msg: bar
5 changes: 5 additions & 0 deletions test/integration/targets/play_iterator/runme.sh
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

set -eux

ansible-playbook playbook.yml --start-at-task 'task 2' "$@"