Create ~/.ssh if it doesn't already exist (#9880)

This commit is contained in:
Henk Tillman
2020-08-04 14:55:15 -07:00
committed by GitHub
parent 55146d222f
commit ead8b86372
2 changed files with 8 additions and 0 deletions
+4
View File
@@ -289,6 +289,10 @@ def _configure_key_pair(config):
ec2 = _resource("ec2", config)
# Writing the new ssh key to the filesystem fails if the ~/.ssh
# directory doesn't already exist.
os.makedirs(os.path.expanduser("~/.ssh"), exist_ok=True)
# Try a few times to get or create a good key pair.
MAX_NUM_KEYS = 30
for i in range(MAX_NUM_KEYS):
+4
View File
@@ -291,6 +291,10 @@ def _configure_key_pair(config, compute):
key_found = True
break
# Writing the new ssh key to the filesystem fails if the ~/.ssh
# directory doesn't already exist.
os.makedirs(os.path.expanduser("~/.ssh"), exist_ok=True)
# Create a key since it doesn't exist locally or in GCP
if not key_found and not os.path.exists(private_key_path):
logger.info("_configure_key_pair: "