mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-01-11 23:25:28 +01:00
Modifying output to be displayed based on feedback
This commit is contained in:
parent
9dbedb6d4c
commit
41bbe0dcbd
2 changed files with 7 additions and 10 deletions
|
|
@ -8,7 +8,6 @@
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
|
|
||||||
DOCUMENTATION = r'''
|
DOCUMENTATION = r'''
|
||||||
---
|
---
|
||||||
module: synchronize
|
module: synchronize
|
||||||
|
|
@ -639,19 +638,17 @@ def main():
|
||||||
while '' in out_lines:
|
while '' in out_lines:
|
||||||
out_lines.remove('')
|
out_lines.remove('')
|
||||||
|
|
||||||
result = dict(changed=changed, rc=rc, cmd=cmdstr)
|
result = dict(changed=changed, rc=rc, cmd=cmdstr, stdout_lines=out_lines, msg=out_clean)
|
||||||
|
|
||||||
if quiet:
|
if quiet:
|
||||||
result['msg'] = "OUTPUT IS HIDDEN DUE TO 'quiet=true'"
|
changes = len(out_lines) - 1 if len(out_lines) >= 1 else 0
|
||||||
result['stdout_lines'] = []
|
result['msg'] = "%s files/directories have been synchronized" % changes
|
||||||
else:
|
|
||||||
result['msg'] = out_clean
|
|
||||||
result['std_out'] = out_lines
|
|
||||||
|
|
||||||
if module._diff:
|
if module._diff:
|
||||||
result['diff'] = {'prepare': out_clean}
|
result['diff'] = {'prepared': out_clean}
|
||||||
|
|
||||||
return module.exit_json(**result)
|
return module.exit_json(**result)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
||||||
|
|
@ -274,7 +274,7 @@
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- '''--quiet'' in sync_result.cmd'
|
- '''files/directories have been synchronized'' in sync_result.msg'
|
||||||
- name: Cleanup
|
- name: Cleanup
|
||||||
file:
|
file:
|
||||||
state: absent
|
state: absent
|
||||||
|
|
@ -290,7 +290,7 @@
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- '''--quiet'' not in sync_result.cmd'
|
- '''files/directories have been synchronized'' not in sync_result.msg'
|
||||||
- name: Cleanup
|
- name: Cleanup
|
||||||
file:
|
file:
|
||||||
state: absent
|
state: absent
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue