Skip to content

Commit 227dd29

Browse files
corey-hammertontimvaillancourt
authored andcommitted
Upload/Rsync/Rsync: Adding a function get_dest_dir() to work like in RsyncUploadThread (#270)
This function returns the joined result of the rsync path and the base dir, exactly like in RsyncUploadThread. This commit adds this function and uses it in the prepare_dest_dir() and in the rsync_config that gets logged.
1 parent b17634a commit 227dd29

File tree

1 file changed

+5
-2
lines changed
  • mongodb_consistent_backup/Upload/Rsync

1 file changed

+5
-2
lines changed

mongodb_consistent_backup/Upload/Rsync/Rsync.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,17 @@ def host_has_rsync(self):
6666
return True
6767
return False
6868

69+
def get_dest_path(self):
70+
return os.path.join(self.rsync_path, self.base_dir)
71+
6972
def prepare_dest_dir(self):
7073
# mkdir -p the rsync dest path via ssh
7174
ssh_mkdir_cmd = ["ssh"]
7275
if self.rsync_ssh_key:
7376
ssh_mkdir_cmd.extend(["-i", self.rsync_ssh_key])
7477
ssh_mkdir_cmd.extend([
7578
"%s@%s" % (self.rsync_user, self.rsync_host),
76-
"mkdir", "-p", self.rsync_path
79+
"mkdir", "-p", self.get_dest_path()
7780
])
7881

7982
# run the mkdir via ssh
@@ -100,7 +103,7 @@ def run(self):
100103
self.prepare_dest_dir()
101104

102105
rsync_config = {
103-
"dest": "%s@%s:%s" % (self.rsync_user, self.rsync_host, self.rsync_path),
106+
"dest": "%s@%s:%s" % (self.rsync_user, self.rsync_host, self.get_dest_path()),
104107
"threads": self.threads(),
105108
"retries": self.retries
106109
}

0 commit comments

Comments
 (0)