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
0d92599d
Commit
0d92599d
authored
Jun 19, 2015
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make exception printing a bit smarter
parent
a77b58e3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
2 deletions
+16
-2
lib/ansible/plugins/action/__init__.py
+1
-1
lib/ansible/plugins/callback/default.py
+15
-1
No files found.
lib/ansible/plugins/action/__init__.py
View file @
0d92599d
...
...
@@ -405,7 +405,7 @@ class ActionBase:
# not valid json, lets try to capture error
data
=
dict
(
failed
=
True
,
parsed
=
False
)
if
'stderr'
in
res
and
res
[
'stderr'
]
.
startswith
(
'Traceback'
):
data
[
'
traceback
'
]
=
res
[
'stderr'
]
data
[
'
exception
'
]
=
res
[
'stderr'
]
else
:
data
[
'msg'
]
=
res
.
get
(
'stdout'
,
''
)
if
'stderr'
in
res
:
...
...
lib/ansible/plugins/callback/default.py
View file @
0d92599d
...
...
@@ -37,10 +37,24 @@ class CallbackModule(CallbackBase):
pass
def
v2_runner_on_failed
(
self
,
result
,
ignore_errors
=
False
):
if
'exception'
in
result
.
_result
and
self
.
_display
.
verbosity
<
3
:
if
'exception'
in
result
.
_result
:
if
self
.
_display
.
verbosity
<
3
:
# extract just the actual error message from the exception text
error
=
result
.
_result
[
'exception'
]
.
strip
()
.
split
(
'
\n
'
)[
-
1
]
msg
=
"An exception occurred during task execution. To see the full traceback, use -vvv. The error was:
%
s"
%
error
else
:
msg
=
"An exception occurred during task execution. The full traceback is:
\n
"
+
result
.
_result
[
'exception'
]
self
.
_display
.
display
(
msg
,
color
=
'red'
)
# finally, remove the exception from the result so it's not shown every time
del
result
.
_result
[
'exception'
]
self
.
_display
.
display
(
"fatal: [
%
s]: FAILED! =>
%
s"
%
(
result
.
_host
.
get_name
(),
json
.
dumps
(
result
.
_result
,
ensure_ascii
=
False
)),
color
=
'red'
)
if
result
.
_task
.
ignore_errors
:
self
.
_display
.
display
(
"...ignoring"
)
def
v2_runner_on_ok
(
self
,
result
):
if
result
.
_task
.
action
==
'include'
:
...
...
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