mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-01-11 07:05:27 +01:00
Modifying based on feedback
This commit is contained in:
parent
ee7748732c
commit
6afd4cdcf1
1 changed files with 14 additions and 9 deletions
|
|
@ -205,7 +205,7 @@ options:
|
||||||
required: false
|
required: false
|
||||||
quiet:
|
quiet:
|
||||||
description:
|
description:
|
||||||
- This specifies rsync quiet option which on yes/true suppresses the non-error messages
|
- This option specifies quiet option which on true suppresses the output.
|
||||||
type: bool
|
type: bool
|
||||||
default: no
|
default: no
|
||||||
version_added: '1.3.0'
|
version_added: '1.3.0'
|
||||||
|
|
@ -367,7 +367,7 @@ EXAMPLES = r'''
|
||||||
dest: /tmp/remotepath
|
dest: /tmp/remotepath
|
||||||
rsync_path: /usr/gnu/bin/rsync
|
rsync_path: /usr/gnu/bin/rsync
|
||||||
|
|
||||||
- name: Synchronization with --quiet option enabled
|
- name: Synchronization with quiet option enabled
|
||||||
ansible.posix.synchronize:
|
ansible.posix.synchronize:
|
||||||
src: some/relative/path
|
src: some/relative/path
|
||||||
dest: /some/absolute/path
|
dest: /some/absolute/path
|
||||||
|
|
@ -651,15 +651,20 @@ def main():
|
||||||
out_lines = out_clean.split('\n')
|
out_lines = out_clean.split('\n')
|
||||||
while '' in out_lines:
|
while '' in out_lines:
|
||||||
out_lines.remove('')
|
out_lines.remove('')
|
||||||
|
|
||||||
|
result = dict(changed=changed, rc=rc, cmd=cmdstr)
|
||||||
|
|
||||||
|
if quiet:
|
||||||
|
result['msg'] = "OUTPUT IS HIDDEN DUE TO 'quiet=true'"
|
||||||
|
result['stdout_lines'] = []
|
||||||
|
else:
|
||||||
|
result['msg'] = out_clean
|
||||||
|
result['std_out'] = out_lines
|
||||||
|
|
||||||
if module._diff:
|
if module._diff:
|
||||||
diff = {'prepared': out_clean}
|
result['diff'] = {'prepare': out_clean}
|
||||||
return module.exit_json(changed=changed, msg=out_clean,
|
|
||||||
rc=rc, cmd=cmdstr, stdout_lines=out_lines,
|
|
||||||
diff=diff)
|
|
||||||
|
|
||||||
return module.exit_json(changed=changed, msg=out_clean,
|
|
||||||
rc=rc, cmd=cmdstr, stdout_lines=out_lines)
|
|
||||||
|
|
||||||
|
return module.exit_json(**result)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue