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
758f1720
Commit
758f1720
authored
Sep 04, 2012
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #996 from dhozac/keep-unsuccessful-result
Keep result pristine for ignore_errors
parents
8f220a4f
7a201dbb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
8 deletions
+4
-8
lib/ansible/callbacks.py
+3
-2
lib/ansible/playbook/__init__.py
+1
-1
lib/ansible/runner/__init__.py
+0
-5
No files found.
lib/ansible/callbacks.py
View file @
758f1720
...
...
@@ -76,11 +76,12 @@ class AggregateStats(object):
prev
=
(
getattr
(
self
,
what
))
.
get
(
host
,
0
)
getattr
(
self
,
what
)[
host
]
=
prev
+
1
def
compute
(
self
,
runner_results
,
setup
=
False
,
poll
=
False
):
def
compute
(
self
,
runner_results
,
setup
=
False
,
poll
=
False
,
ignore_errors
=
False
):
''' walk through all results and increment stats '''
for
(
host
,
value
)
in
runner_results
.
get
(
'contacted'
,
{})
.
iteritems
():
if
(
'failed'
in
value
and
bool
(
value
[
'failed'
]))
or
(
'rc'
in
value
and
value
[
'rc'
]
!=
0
):
if
not
ignore_errors
and
((
'failed'
in
value
and
bool
(
value
[
'failed'
]))
or
(
'rc'
in
value
and
value
[
'rc'
]
!=
0
)):
self
.
_increment
(
'failures'
,
host
)
elif
'skipped'
in
value
and
bool
(
value
[
'skipped'
]):
self
.
_increment
(
'skipped'
,
host
)
...
...
lib/ansible/playbook/__init__.py
View file @
758f1720
...
...
@@ -246,7 +246,7 @@ class PlayBook(object):
if
results
is
None
:
results
=
{}
self
.
stats
.
compute
(
results
)
self
.
stats
.
compute
(
results
,
ignore_errors
=
task
.
ignore_errors
)
# add facts to the global setup cache
for
host
,
result
in
results
[
'contacted'
]
.
iteritems
():
...
...
lib/ansible/runner/__init__.py
View file @
758f1720
...
...
@@ -616,11 +616,6 @@ class Runner(object):
elif
not
result
.
is_successful
():
ignore_errors
=
self
.
module_vars
.
get
(
'ignore_errors'
,
False
)
self
.
callbacks
.
on_failed
(
host
,
data
,
ignore_errors
)
if
ignore_errors
:
if
'failed'
in
result
.
result
:
result
.
result
[
'failed'
]
=
False
if
'rc'
in
result
.
result
:
result
.
result
[
'rc'
]
=
0
else
:
self
.
callbacks
.
on_ok
(
host
,
data
)
return
result
...
...
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