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
60c139e4
Commit
60c139e4
authored
Sep 15, 2015
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix logic for changed/failed_when + retry/until loops
Fixes #11809
parent
8e664ad2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
9 deletions
+21
-9
lib/ansible/executor/task_executor.py
+21
-9
No files found.
lib/ansible/executor/task_executor.py
View file @
60c139e4
...
@@ -354,20 +354,29 @@ class TaskExecutor:
...
@@ -354,20 +354,29 @@ class TaskExecutor:
# create a conditional object to evaluate task conditions
# create a conditional object to evaluate task conditions
cond
=
Conditional
(
loader
=
self
.
_loader
)
cond
=
Conditional
(
loader
=
self
.
_loader
)
# FIXME: make sure until is mutually exclusive with changed_when/failed_when
def
_evaluate_changed_when_result
(
result
):
if
self
.
_task
.
until
:
if
self
.
_task
.
changed_when
is
not
None
:
cond
.
when
=
self
.
_task
.
until
if
cond
.
evaluate_conditional
(
templar
,
vars_copy
):
break
elif
(
self
.
_task
.
changed_when
or
self
.
_task
.
failed_when
)
and
'skipped'
not
in
result
:
if
self
.
_task
.
changed_when
:
cond
.
when
=
[
self
.
_task
.
changed_when
]
cond
.
when
=
[
self
.
_task
.
changed_when
]
result
[
'changed'
]
=
cond
.
evaluate_conditional
(
templar
,
vars_copy
)
result
[
'changed'
]
=
cond
.
evaluate_conditional
(
templar
,
vars_copy
)
if
self
.
_task
.
failed_when
:
def
_evaluate_failed_when_result
(
result
):
if
self
.
_task
.
failed_when
is
not
None
:
cond
.
when
=
[
self
.
_task
.
failed_when
]
cond
.
when
=
[
self
.
_task
.
failed_when
]
failed_when_result
=
cond
.
evaluate_conditional
(
templar
,
vars_copy
)
failed_when_result
=
cond
.
evaluate_conditional
(
templar
,
vars_copy
)
result
[
'failed_when_result'
]
=
result
[
'failed'
]
=
failed_when_result
result
[
'failed_when_result'
]
=
result
[
'failed'
]
=
failed_when_result
if
failed_when_result
:
return
failed_when_result
return
False
# FIXME: make sure until is mutually exclusive with changed_when/failed_when
if
self
.
_task
.
until
:
cond
.
when
=
self
.
_task
.
until
if
cond
.
evaluate_conditional
(
templar
,
vars_copy
):
_evaluate_changed_when_result
(
result
)
_evaluate_failed_when_result
(
result
)
break
elif
(
self
.
_task
.
changed_when
is
not
None
or
self
.
_task
.
failed_when
is
not
None
)
and
'skipped'
not
in
result
:
_evaluate_changed_when_result
(
result
)
if
_evaluate_failed_when_result
(
result
):
break
break
elif
'failed'
not
in
result
:
elif
'failed'
not
in
result
:
if
result
.
get
(
'rc'
,
0
)
!=
0
:
if
result
.
get
(
'rc'
,
0
)
!=
0
:
...
@@ -378,6 +387,9 @@ class TaskExecutor:
...
@@ -378,6 +387,9 @@ class TaskExecutor:
if
attempt
<
retries
-
1
:
if
attempt
<
retries
-
1
:
time
.
sleep
(
delay
)
time
.
sleep
(
delay
)
else
:
_evaluate_changed_when_result
(
result
)
_evaluate_failed_when_result
(
result
)
# do the final update of the local variables here, for both registered
# do the final update of the local variables here, for both registered
# values and any facts which may have been created
# values and any facts which may have been created
...
...
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