Properly call mkdir on rsync (#9995)

This commit is contained in:
Ian Rodney
2020-08-09 21:31:28 -07:00
committed by GitHub
parent 26b36a1982
commit 7b87da7f03
+4 -4
View File
@@ -484,8 +484,8 @@ class DockerCommandRunner(SSHCommandRunner):
protected_path = target
if target.find("/root") == 0:
target = target.replace("/root", "/tmp/root")
self.ssh_command_runner.run(
f"mkdir -p {os.path.dirname(target)}", run_env="host")
self.ssh_command_runner.run(
f"mkdir -p {os.path.dirname(target.rstrip('/'))}", run_env="host")
self.ssh_command_runner.run_rsync_up(source, target)
if self._check_container_status():
self.ssh_command_runner.run("docker cp {} {}:{}".format(
@@ -496,8 +496,8 @@ class DockerCommandRunner(SSHCommandRunner):
protected_path = source
if source.find("/root") == 0:
source = source.replace("/root", "/tmp/root")
self.ssh_command_runner.run(
f"mkdir -p {os.path.dirname(source)}", run_env="host")
self.ssh_command_runner.run(
f"mkdir -p {os.path.dirname(source.rstrip('/'))}", run_env="host")
self.ssh_command_runner.run("docker cp {}:{} {}".format(
self.docker_name, self._docker_expand_user(protected_path),
source))