From 9c83e1728292434b83efa6ea8542d2ce9c7debd9 Mon Sep 17 00:00:00 2001 From: Matyas Selmeci Date: Tue, 5 Oct 2021 15:11:36 -0500 Subject: [PATCH 1/2] Remove the old wn-client installation after we've updated it A wn-client installation doesn't use much _space_ but it does use many _files_ (~4000) and if you have an inode quota, those can add up --- scripts/update-remote-wn-client | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/update-remote-wn-client b/scripts/update-remote-wn-client index 6941a02..0bc55e9 100755 --- a/scripts/update-remote-wn-client +++ b/scripts/update-remote-wn-client @@ -183,12 +183,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) From 1638183c196831a39fc30f392122eb072e5fc547 Mon Sep 17 00:00:00 2001 From: Matyas Selmeci Date: Tue, 5 Oct 2021 15:46:31 -0500 Subject: [PATCH 2/2] Also write files in-place instead of creating temp files --- scripts/update-remote-wn-client | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/update-remote-wn-client b/scripts/update-remote-wn-client index 0bc55e9..d656e76 100755 --- a/scripts/update-remote-wn-client +++ b/scripts/update-remote-wn-client @@ -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 @@ -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: