From 3e6b866cae62707d0fb8ab2b58e9487c01388f09 Mon Sep 17 00:00:00 2001 From: Matt Coddington Date: Fri, 9 Mar 2012 15:43:49 -0500 Subject: [PATCH] support rsync for remote copy --- lib/cdist/exec/remote.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/cdist/exec/remote.py b/lib/cdist/exec/remote.py index 124c1b4f..2e7d9d10 100644 --- a/lib/cdist/exec/remote.py +++ b/lib/cdist/exec/remote.py @@ -77,7 +77,12 @@ class Remote(object): self.log.debug("Remote transfer: %s -> %s", source, destination) self.rmdir(destination) command = self._copy.split() - command.extend(["-r", source, self.target_host + ":" + destination]) + # support rsync by appending a "/" to the source if it's a directory + if os.path.isdir(source) == True: + command.extend(["-r", source + "/", self.target_host + ":" + destination]) + else: + command.extend(["-r", source, self.target_host + ":" + destination]) + self._run_command(command) def run_script(self, script, env=None, return_output=False):