Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the old wn-client installation after we've updated it #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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