Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
8fae2abe
Commit
8fae2abe
authored
May 05, 2015
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly fail out of the task loop in the linear strategy on failures (v2)
parent
fba55880
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
1 deletions
+19
-1
lib/ansible/executor/playbook_executor.py
+7
-1
lib/ansible/plugins/strategies/linear.py
+3
-0
samples/test_play_failure.yml
+9
-0
No files found.
lib/ansible/executor/playbook_executor.py
View file @
8fae2abe
...
...
@@ -117,15 +117,17 @@ class PlaybookExecutor:
if
len
(
batch
)
==
0
:
self
.
_tqm
.
send_callback
(
'v2_playbook_on_play_start'
,
new_play
)
self
.
_tqm
.
send_callback
(
'v2_playbook_on_no_hosts_matched'
)
result
=
0
result
=
1
break
# restrict the inventory to the hosts in the serialized batch
self
.
_inventory
.
restrict_to_hosts
(
batch
)
# and run it...
result
=
self
.
_tqm
.
run
(
play
=
play
)
# if the last result wasn't zero, break out of the serial batch loop
if
result
!=
0
:
break
# if the last result wasn't zero, break out of the play loop
if
result
!=
0
:
break
...
...
@@ -134,6 +136,10 @@ class PlaybookExecutor:
if
entry
:
entrylist
.
append
(
entry
)
# per playbook
# if the last result wasn't zero, break out of the playbook file name loop
if
result
!=
0
:
break
if
entrylist
:
return
entrylist
...
...
lib/ansible/plugins/strategies/linear.py
View file @
8fae2abe
...
...
@@ -226,6 +226,9 @@ class StrategyModule(StrategyBase):
# FIXME: this should also be moved to the base class in a method
included_files
=
[]
for
res
in
host_results
:
if
res
.
is_failed
():
return
1
if
res
.
_task
.
action
==
'include'
:
if
res
.
_task
.
loop
:
include_results
=
res
.
_result
[
'results'
]
...
...
samples/test_play_failure.yml
0 → 100644
View file @
8fae2abe
-
hosts
:
localhost
gather_facts
:
no
tasks
:
-
fail
:
-
hosts
:
localhost
gather_facts
:
no
tasks
:
-
debug
:
msg="you should not see me..."
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment