From afe4ec833479e140b3e417282cf47100944dce0b Mon Sep 17 00:00:00 2001 From: Mandar Kulkarni Date: Mon, 12 Jul 2021 10:21:36 -0700 Subject: [PATCH] Fix: moving conditional to correct place --- plugins/modules/synchronize.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/modules/synchronize.py b/plugins/modules/synchronize.py index 9217c91..9cc5fdc 100644 --- a/plugins/modules/synchronize.py +++ b/plugins/modules/synchronize.py @@ -189,6 +189,7 @@ options: - This specifies rsync quiet option which on yes/true suppresses the non-error messages type: bool default: no + version_added: '1.3.0' notes: - rsync must be installed on both the local and remote host. @@ -598,6 +599,9 @@ def main(): if '@' not in dest: dest = os.path.expanduser(dest) + if quiet: + cmd.append('--quiet') + cmd.append(source) cmd.append(dest) cmdstr = ' '.join(cmd) @@ -619,9 +623,6 @@ def main(): else: (rc, out, err) = module.run_command(cmd) - if quiet: - cmd.append('--quiet') - if rc: return module.fail_json(msg=err, rc=rc, cmd=cmdstr)