Skip to content

Commit 8cdd122

Browse files
author
mandar
committed
Adding tests, corrections
1 parent 8ceac49 commit 8cdd122

File tree

3 files changed

+36
-3
lines changed

3 files changed

+36
-3
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
minor_changes:
2-
- synchronize - add the ``quiet`` option to supress non-error messages (https://github.com/ansible-collections/ansible.posix/issues/171).
2+
- synchronize - add the ``quiet`` option to suppress non-error messages (https://github.com/ansible-collections/ansible.posix/issues/171).

plugins/modules/synchronize.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
version_added: '1.3.0'
187187
quiet:
188188
description:
189-
- This specifies rsync quiet option which on yes/true suppresses the non-error messages
189+
- This specifies rsync quiet option which on yes/true suppresses the non-error messages.
190190
type: bool
191191
default: no
192192
version_added: '1.3.0'
@@ -429,7 +429,7 @@ def main():
429429
delay_updates=dict(type='bool', default=True),
430430
mode=dict(type='str', default='push', choices=['pull', 'push']),
431431
link_dest=dict(type='list', elements='str'),
432-
quiet=dict(type='bool',default=False)
432+
quiet=dict(type='bool', default=False)
433433
),
434434
supports_check_mode=True,
435435
)

tests/integration/targets/synchronize/tasks/main.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,3 +227,36 @@
227227
- directory_a/foo.txt
228228
- directory_a
229229
- directory_b
230+
- name: synchronize files with quiet option
231+
synchronize:
232+
src: '{{output_dir}}/foo.txt'
233+
dest: '{{output_dir}}/foo.result'
234+
quiet: true
235+
register: sync_result
236+
ignore_errors: true
237+
- assert:
238+
that:
239+
- '''--quiet'' in sync_result.cmd'
240+
- name: Cleanup
241+
file:
242+
state: absent
243+
path: '{{output_dir}}/{{item}}'
244+
with_items:
245+
- foo.result
246+
- bar.result
247+
- name: synchronize files without quiet option
248+
synchronize:
249+
src: '{{output_dir}}/foo.txt'
250+
dest: '{{output_dir}}/foo.result'
251+
register: sync_result
252+
ignore_errors: true
253+
- assert:
254+
that:
255+
- '''--quiet'' not in sync_result.cmd'
256+
- name: Cleanup
257+
file:
258+
state: absent
259+
path: '{{output_dir}}/{{item}}'
260+
with_items:
261+
- foo.result
262+
- bar.result

0 commit comments

Comments
 (0)