[Autoscaler] Ensure ubuntu is owner of docker host mount folder (#13579)

* change ownership to ubuntu if root

* use ssh user in cluster config

* formatting

Co-authored-by: Nikita Vemuri <nikitavemuri@Nikitas-MacBook-Pro.local>
This commit is contained in:
Nikita Vemuri
2021-01-21 17:01:55 -08:00
committed by GitHub
parent 0998d69968
commit 4e01a9ec38
@@ -632,8 +632,10 @@ class DockerCommandRunner(CommandRunnerInterface):
self._get_docker_host_mount_location(
self.ssh_command_runner.cluster_name), target.lstrip("/"))
host_mount_location = os.path.dirname(host_destination.rstrip("/"))
self.ssh_command_runner.run(
f"mkdir -p {os.path.dirname(host_destination.rstrip('/'))}",
f"mkdir -p {host_mount_location} && chown -R "
f"{self.ssh_command_runner.ssh_user} {host_mount_location}",
silent=is_rsync_silent())
self.ssh_command_runner.run_rsync_up(
@@ -655,8 +657,10 @@ class DockerCommandRunner(CommandRunnerInterface):
host_source = os.path.join(
self._get_docker_host_mount_location(
self.ssh_command_runner.cluster_name), source.lstrip("/"))
host_mount_location = os.path.dirname(host_source.rstrip("/"))
self.ssh_command_runner.run(
f"mkdir -p {os.path.dirname(host_source.rstrip('/'))}",
f"mkdir -p {host_mount_location} && chown -R "
f"{self.ssh_command_runner.ssh_user} {host_mount_location}",
silent=is_rsync_silent())
if source[-1] == "/":
source += "."