[Autoscaler] Actually try to catch when docker does not exist (#10549)

This commit is contained in:
Ian Rodney 2020-09-03 14:00:06 -07:00 committed by GitHub
parent 89bf262130
commit c54853d45b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -659,10 +659,11 @@ class DockerCommandRunner(CommandRunnerInterface):
self.container_name) self.container_name)
def _check_docker_installed(self): def _check_docker_installed(self):
try: no_exist = "NoExist"
self.ssh_command_runner.run("command -v docker") output = self.ssh_command_runner.run(
return f"command -v docker || echo '{no_exist}'", with_output=True)
except Exception: cleaned_output = output.decode().strip()
if no_exist in cleaned_output or "docker" not in cleaned_output:
install_commands = [ install_commands = [
"curl -fsSL https://get.docker.com -o get-docker.sh", "curl -fsSL https://get.docker.com -o get-docker.sh",
"sudo sh get-docker.sh", "sudo usermod -aG docker $USER", "sudo sh get-docker.sh", "sudo usermod -aG docker $USER",