Skip to content

Commit

Permalink
Adding tests, corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
mandar committed Jul 13, 2021
1 parent 8ceac49 commit 8cdd122
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
2 changes: 1 addition & 1 deletion changelogs/fragments/220_synchronize_add_quiet_option.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
minor_changes:
- synchronize - add the ``quiet`` option to supress non-error messages (https://github.com/ansible-collections/ansible.posix/issues/171).
- synchronize - add the ``quiet`` option to suppress non-error messages (https://github.com/ansible-collections/ansible.posix/issues/171).
4 changes: 2 additions & 2 deletions plugins/modules/synchronize.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
version_added: '1.3.0'
quiet:
description:
- This specifies rsync quiet option which on yes/true suppresses the non-error messages
- This specifies rsync quiet option which on yes/true suppresses the non-error messages.
type: bool
default: no
version_added: '1.3.0'
Expand Down Expand Up @@ -429,7 +429,7 @@ def main():
delay_updates=dict(type='bool', default=True),
mode=dict(type='str', default='push', choices=['pull', 'push']),
link_dest=dict(type='list', elements='str'),
quiet=dict(type='bool',default=False)
quiet=dict(type='bool', default=False)
),
supports_check_mode=True,
)
Expand Down
33 changes: 33 additions & 0 deletions tests/integration/targets/synchronize/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,36 @@
- directory_a/foo.txt
- directory_a
- directory_b
- name: synchronize files with quiet option
synchronize:
src: '{{output_dir}}/foo.txt'
dest: '{{output_dir}}/foo.result'
quiet: true
register: sync_result
ignore_errors: true
- assert:
that:
- '''--quiet'' in sync_result.cmd'
- name: Cleanup
file:
state: absent
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

0 comments on commit 8cdd122

Please sign in to comment.