mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-01-11 15:15:26 +01:00
Modifying output to be displayed based on feedback
This commit is contained in:
parent
e72424ae50
commit
b4fe18e6ff
2 changed files with 5 additions and 31 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
|
||||||
|
|
@ -652,19 +651,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()
|
||||||
|
|
|
||||||
|
|
@ -342,32 +342,9 @@
|
||||||
- name: Cleanup
|
- name: Cleanup
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
state: absent
|
state: absent
|
||||||
<<<<<<< HEAD
|
|
||||||
path: "{{ output_dir }}/{{ item }}"
|
path: "{{ output_dir }}/{{ item }}"
|
||||||
loop:
|
loop:
|
||||||
- directory b/foo.txt
|
- directory b/foo.txt
|
||||||
- directory a/foo.txt
|
- directory a/foo.txt
|
||||||
- directory a
|
- directory a
|
||||||
- directory b
|
- directory b
|
||||||
=======
|
|
||||||
path: '{{output_dir}}/{{item}}'
|
|
||||||
with_items:
|
|
||||||
- foo.result
|
|
||||||
- bar.result
|
|
||||||
- name: synchronize files without quiet option
|
|
||||||
synchronize:
|
|
||||||
src: '{{output_dir}}/foo.txt'
|
|
||||||
dest: '{{output_dir}}/foo.result'
|
|
||||||
register: sync_result
|
|
||||||
ignore_errors: true
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- '''--quiet'' not in sync_result.cmd'
|
|
||||||
- name: Cleanup
|
|
||||||
file:
|
|
||||||
state: absent
|
|
||||||
path: '{{output_dir}}/{{item}}'
|
|
||||||
with_items:
|
|
||||||
- foo.result
|
|
||||||
- bar.result
|
|
||||||
>>>>>>> 9dbedb6 (Adding tests, corrections)
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue