1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fixing up some output stuff

This commit is contained in:
James Cammarata 2015-07-14 00:23:17 -04:00
parent 9a586c3512
commit 6971e92f39
4 changed files with 11 additions and 29 deletions

View file

@ -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'])

View file

@ -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:
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

View file

@ -49,7 +49,7 @@ class CallbackBase:
if sanitize: if sanitize:
res = self._sanitize_result(result) res = self._sanitize_result(result)
else: else:
res = results 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):

View file

@ -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 @@
- "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 @@
- 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