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
19386c43
Commit
19386c43
authored
Oct 07, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge
parent
d1058222
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
15 deletions
+5
-15
docsite/latest/rst/playbooks_loops.rst
+0
-13
lib/ansible/runner/__init__.py
+5
-2
No files found.
docsite/latest/rst/playbooks_loops.rst
View file @
19386c43
...
@@ -211,16 +211,6 @@ been retried for 5 times with a delay of 10 seconds. The default value for "retr
...
@@ -211,16 +211,6 @@ been retried for 5 times with a delay of 10 seconds. The default value for "retr
The task returns the results returned by the last task run. The results of individual retries can be viewed by -vv option.
The task returns the results returned by the last task run. The results of individual retries can be viewed by -vv option.
The registered variable will also have a new key "attempts" which will have the number of the retries for the task.
The registered variable will also have a new key "attempts" which will have the number of the retries for the task.
The Do/Until feature does not take decision on whether to fail or pass the play when the maximum retries are completed, the user can
can do that in the next task as follows::
- action: shell /usr/bin/foo
register: result
until: result.stdout.find("all systems go") != -1
retries: 5
delay: 10
failed_when: result.attempts == 5
.. seealso::
.. seealso::
:doc:`playbooks`
:doc:`playbooks`
...
@@ -239,6 +229,3 @@ can do that in the next task as follows::
...
@@ -239,6 +229,3 @@ can do that in the next task as follows::
#ansible IRC chat channel
#ansible IRC chat channel
lib/ansible/runner/__init__.py
View file @
19386c43
...
@@ -660,7 +660,7 @@ class Runner(object):
...
@@ -660,7 +660,7 @@ class Runner(object):
result
=
handler
.
run
(
conn
,
tmp
,
module_name
,
module_args
,
inject
,
complex_args
)
result
=
handler
.
run
(
conn
,
tmp
,
module_name
,
module_args
,
inject
,
complex_args
)
# Code for do until feature
# Code for do until feature
until
=
self
.
module_vars
.
get
(
'until'
,
None
)
until
=
self
.
module_vars
.
get
(
'until'
,
None
)
if
until
is
not
None
and
result
.
comm_ok
:
if
until
is
not
None
and
result
.
comm_ok
and
"failed"
not
in
result
.
result
:
inject
[
self
.
module_vars
.
get
(
'register'
)]
=
result
.
result
inject
[
self
.
module_vars
.
get
(
'register'
)]
=
result
.
result
cond
=
template
.
template
(
self
.
basedir
,
until
,
inject
,
expand_lists
=
False
)
cond
=
template
.
template
(
self
.
basedir
,
until
,
inject
,
expand_lists
=
False
)
if
not
utils
.
check_conditional
(
cond
,
self
.
basedir
,
inject
,
fail_on_undefined
=
self
.
error_on_undefined_vars
):
if
not
utils
.
check_conditional
(
cond
,
self
.
basedir
,
inject
,
fail_on_undefined
=
self
.
error_on_undefined_vars
):
...
@@ -674,12 +674,15 @@ class Runner(object):
...
@@ -674,12 +674,15 @@ class Runner(object):
result
=
handler
.
run
(
conn
,
tmp
,
module_name
,
module_args
,
inject
,
complex_args
)
result
=
handler
.
run
(
conn
,
tmp
,
module_name
,
module_args
,
inject
,
complex_args
)
result
.
result
[
'attempts'
]
=
x
result
.
result
[
'attempts'
]
=
x
vv
(
"Result from run
%
i is:
%
s"
%
(
x
,
result
.
result
))
vv
(
"Result from run
%
i is:
%
s"
%
(
x
,
result
.
result
))
if
not
result
.
comm_ok
:
if
"failed"
in
result
.
result
:
break
break
inject
[
self
.
module_vars
.
get
(
'register'
)]
=
result
.
result
inject
[
self
.
module_vars
.
get
(
'register'
)]
=
result
.
result
cond
=
template
.
template
(
self
.
basedir
,
until
,
inject
,
expand_lists
=
False
)
cond
=
template
.
template
(
self
.
basedir
,
until
,
inject
,
expand_lists
=
False
)
if
utils
.
check_conditional
(
cond
,
self
.
basedir
,
inject
,
fail_on_undefined
=
self
.
error_on_undefined_vars
):
if
utils
.
check_conditional
(
cond
,
self
.
basedir
,
inject
,
fail_on_undefined
=
self
.
error_on_undefined_vars
):
break
break
if
result
.
result
[
'attempts'
]
==
retries
and
not
utils
.
check_conditional
(
cond
,
self
.
basedir
,
inject
,
fail_on_undefined
=
self
.
error_on_undefined_vars
):
result
.
result
[
'failed'
]
=
True
result
.
result
[
'msg'
]
=
"Task failed as maximum retries was encountered"
else
:
else
:
result
.
result
[
'attempts'
]
=
0
result
.
result
[
'attempts'
]
=
0
conn
.
close
()
conn
.
close
()
...
...
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