Create .ssh directory if it does not exist yet
authorHelga Velroyen <helgav@google.com>
Wed, 1 Jul 2015 15:22:23 +0000 (17:22 +0200)
committerHelga Velroyen <helgav@google.com>
Fri, 3 Jul 2015 09:32:16 +0000 (11:32 +0200)
This patch extends the SSH handling by creating the .ssh
directory when generating SSH keys if it did not exist
yet. This fixes Issue 1103.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>

lib/ssh.py

index 4514b5e..bf39606 100644 (file)
@@ -684,7 +684,7 @@ def InitSSHSetup(error_fn=errors.OpPrereqError, _homedir_fn=None,
 
   """
   priv_key, _, auth_keys = GetUserFiles(constants.SSH_LOGIN_USER,
-                                        _homedir_fn=_homedir_fn)
+                                        mkdir=True, _homedir_fn=_homedir_fn)
 
   new_priv_key_name = priv_key + _suffix
   new_pub_key_name = priv_key + _suffix + ".pub"