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
c58aaf72
Commit
c58aaf72
authored
Apr 21, 2015
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly handle lack of stdout in results in v2
Fixes #10549
parent
351591fb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
16 deletions
+16
-16
v2/ansible/plugins/action/__init__.py
+16
-16
No files found.
v2/ansible/plugins/action/__init__.py
View file @
c58aaf72
...
@@ -412,22 +412,22 @@ class ActionBase:
...
@@ -412,22 +412,22 @@ class ActionBase:
cmd2
=
self
.
_shell
.
remove
(
tmp
,
recurse
=
True
)
cmd2
=
self
.
_shell
.
remove
(
tmp
,
recurse
=
True
)
self
.
_low_level_execute_command
(
cmd2
,
tmp
,
sudoable
=
False
)
self
.
_low_level_execute_command
(
cmd2
,
tmp
,
sudoable
=
False
)
# FIXME: in error situations, the stdout may not contain valid data, so we
try
:
# should check for bad rc codes better to catch this here
data
=
json
.
loads
(
self
.
_filter_leading_non_json_lines
(
res
.
get
(
'stdout'
,
''
)))
if
'stdout'
in
res
and
res
[
'stdout'
]
.
strip
()
:
except
ValueError
:
try
:
# not valid json, lets try to capture error
data
=
json
.
loads
(
self
.
_filter_leading_non_json_lines
(
res
[
'stdout'
])
)
data
=
dict
(
failed
=
True
,
parsed
=
False
)
except
ValueError
:
if
'stderr'
in
res
and
res
[
'stderr'
]
.
startswith
(
'Traceback'
)
:
# not valid json, lets try to capture error
data
[
'traceback'
]
=
res
[
'stderr'
]
data
=
{
'traceback'
:
res
[
'stdout'
]}
else
:
if
'parsed'
in
data
and
data
[
'parsed'
]
==
False
:
data
[
'msg'
]
=
res
.
get
(
'stdout'
,
''
)
data
[
'msg'
]
+=
res
[
'stderr'
]
if
'stderr'
in
res
:
# pre-split stdout into lines, if stdout is in the data and there
data
[
'msg'
]
+=
res
[
'stderr'
]
# isn't already a stdout_lines value there
if
'stdout'
in
data
and
'stdout_lines'
not
in
data
:
# pre-split stdout into lines, if stdout is in the data and there
data
[
'stdout_lines'
]
=
data
.
get
(
'stdout'
,
''
)
.
splitlines
()
# isn't already a stdout_lines value there
else
:
if
'stdout'
in
data
and
'stdout_lines'
not
in
data
:
data
=
dict
()
data
[
'stdout_lines'
]
=
data
.
get
(
'stdout'
,
''
)
.
splitlines
()
# store the module invocation details back into the result
# store the module invocation details back into the result
data
[
'invocation'
]
=
dict
(
data
[
'invocation'
]
=
dict
(
...
...
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