Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions scripts/update-remote-wn-client
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ def rsync_upload(local_dir, remote_user, remote_host, remote_dir, ssh_key=None):
# If remote dir is missing then just upload and return
subprocess.check_call(["rsync", "-e", " ".join(ssh),
"-qaz",
"--inplace",
local_dir,
"%s:%s" % (remote_host, remote_dir)])
return
Expand All @@ -175,6 +176,7 @@ def rsync_upload(local_dir, remote_user, remote_host, remote_dir, ssh_key=None):
"-qaz",
"--link-dest", remote_dir,
"--delete-before",
"--inplace",
local_dir,
"%s:%s" % (remote_host, newdir)])
except (OSError, CalledProcessError) as e:
Expand All @@ -183,12 +185,15 @@ def rsync_upload(local_dir, remote_user, remote_host, remote_dir, ssh_key=None):
# then rename destdir to olddir and newdir to destdir
try:
log.info("Moving %s to %s", newdir, remote_dir)
olddir_q = shlex_quote(olddir)
remote_dir_q = shlex_quote(remote_dir)
newdir_q = shlex_quote(newdir)
subprocess.check_call(ssh +
[remote_host,
"rm -rf {0} && "
"mv {1} {0} && "
"mv {2} {1}".format(
shlex_quote(olddir), shlex_quote(remote_dir), shlex_quote(newdir))])
"rm -rf {olddir_q} && "
"mv {remote_dir_q} {olddir_q} && "
"mv {newdir_q} {remote_dir_q} && "
"rm -rf {olddir_q}".format(**locals())])
except (OSError, CalledProcessError) as e:
raise Error("Error renaming remote directories: %s" % e)

Expand Down