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
6971e92f
Commit
6971e92f
authored
Jul 14, 2015
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing up some output stuff
parent
9a586c35
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
29 deletions
+11
-29
lib/ansible/constants.py
+1
-1
lib/ansible/plugins/action/__init__.py
+6
-5
lib/ansible/plugins/callback/__init__.py
+1
-1
test/integration/roles/test_command_shell/tasks/main.yml
+3
-22
No files found.
lib/ansible/constants.py
View file @
6971e92f
...
@@ -235,4 +235,4 @@ DEFAULT_SUBSET = None
...
@@ -235,4 +235,4 @@ DEFAULT_SUBSET = None
DEFAULT_SU_PASS
=
None
DEFAULT_SU_PASS
=
None
VAULT_VERSION_MIN
=
1.0
VAULT_VERSION_MIN
=
1.0
VAULT_VERSION_MAX
=
1.0
VAULT_VERSION_MAX
=
1.0
RESULT_SANITIZE
=
frozenset
([
'
invocation'
,
'
warnings'
])
RESULT_SANITIZE
=
frozenset
([
'warnings'
])
lib/ansible/plugins/action/__init__.py
View file @
6971e92f
...
@@ -23,7 +23,7 @@ from six.moves import StringIO
...
@@ -23,7 +23,7 @@ from six.moves import StringIO
import
json
import
json
import
os
import
os
import
random
import
random
import
sys
# FIXME: probably not needed
import
sys
import
tempfile
import
tempfile
import
time
import
time
...
@@ -404,10 +404,11 @@ class ActionBase:
...
@@ -404,10 +404,11 @@ class ActionBase:
data
[
'stdout_lines'
]
=
data
.
get
(
'stdout'
,
''
)
.
splitlines
()
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
(
if
self
.
_task
.
async
is
not
None
:
module_args
=
module_args
,
data
[
'invocation'
]
=
dict
(
module_name
=
module_name
,
module_args
=
module_args
,
)
module_name
=
module_name
,
)
debug
(
"done with _execute_module (
%
s,
%
s)"
%
(
module_name
,
module_args
))
debug
(
"done with _execute_module (
%
s,
%
s)"
%
(
module_name
,
module_args
))
return
data
return
data
...
...
lib/ansible/plugins/callback/__init__.py
View file @
6971e92f
...
@@ -49,7 +49,7 @@ class CallbackBase:
...
@@ -49,7 +49,7 @@ class CallbackBase:
if
sanitize
:
if
sanitize
:
res
=
self
.
_sanitize_result
(
result
)
res
=
self
.
_sanitize_result
(
result
)
else
:
else
:
res
=
result
s
res
=
result
return
json
.
dumps
(
res
,
indent
=
indent
,
ensure_ascii
=
False
,
sort_keys
=
sort_keys
)
return
json
.
dumps
(
res
,
indent
=
indent
,
ensure_ascii
=
False
,
sort_keys
=
sort_keys
)
def
_sanitize_result
(
self
,
result
):
def
_sanitize_result
(
self
,
result
):
...
...
test/integration/roles/test_command_shell/tasks/main.yml
View file @
6971e92f
...
@@ -127,7 +127,6 @@
...
@@ -127,7 +127,6 @@
-
"
shell_result0.rc
==
0"
-
"
shell_result0.rc
==
0"
-
"
shell_result0.stderr
==
''"
-
"
shell_result0.stderr
==
''"
-
"
shell_result0.stdout
==
'win'"
-
"
shell_result0.stdout
==
'win'"
-
"
not
shell_result0.warnings"
# executable
# executable
...
@@ -156,7 +155,6 @@
...
@@ -156,7 +155,6 @@
-
"
shell_result2.rc
==
0"
-
"
shell_result2.rc
==
0"
-
"
shell_result2.stderr
==
''"
-
"
shell_result2.stderr
==
''"
-
"
shell_result2.stdout
==
'win'"
-
"
shell_result2.stdout
==
'win'"
-
"
not
shell_result2.warnings"
# creates
# creates
...
@@ -169,28 +167,11 @@
...
@@ -169,28 +167,11 @@
-
name
:
verify that afile.txt is present
-
name
:
verify that afile.txt is present
file
:
path={{output_dir_test}}/afile.txt state=file
file
:
path={{output_dir_test}}/afile.txt state=file
# removes
-
name
:
remove afile.txt using rm
shell
:
rm {{output_dir_test | expanduser}}/afile.txt removes={{output_dir_test | expanduser}}/afile.txt
register
:
shell_result3
-
name
:
assert that using rm under shell causes a warning
assert
:
that
:
-
"
shell_result3.warnings"
-
name
:
verify that afile.txt is absent
file
:
path={{output_dir_test}}/afile.txt state=absent
register
:
shell_result4
-
name
:
assert that the file was removed by the shell
assert
:
that
:
-
"
shell_result4.changed
==
False"
# multiline
# multiline
-
name
:
remove test file previously created
file
:
path={{output_dir_test | expanduser}}/afile.txt state=absent
-
name
:
execute a shell command using a literal multiline block
-
name
:
execute a shell command using a literal multiline block
args
:
args
:
executable
:
/bin/bash
executable
:
/bin/bash
...
...
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