From f712208d1366aadaf1b2cdaeac730a0216266fc7 Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Wed, 24 Oct 2012 01:16:50 +0200
Subject: [PATCH] prepare-node-join: Use ssh.GetAllUserFiles
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Instead of building the dictionary locally, the global version in
β€œssh.py” can be used.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 lib/tools/prepare_node_join.py | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/lib/tools/prepare_node_join.py b/lib/tools/prepare_node_join.py
index e8f7c8d67..37bd0bccc 100644
--- a/lib/tools/prepare_node_join.py
+++ b/lib/tools/prepare_node_join.py
@@ -282,17 +282,11 @@ def UpdateSshRoot(data, dry_run, _homedir_fn=None):
   if not keys:
     return
 
-  (dsa_private_file, dsa_public_file, auth_keys_file) = \
-    ssh.GetUserFiles(constants.SSH_LOGIN_USER, mkdir=True,
-                     kind=constants.SSHK_DSA, _homedir_fn=_homedir_fn)
-  (rsa_private_file, rsa_public_file, _) = \
-    ssh.GetUserFiles(constants.SSH_LOGIN_USER, mkdir=True,
-                     kind=constants.SSHK_RSA, _homedir_fn=_homedir_fn)
-
-  _UpdateKeyFiles(keys, dry_run, {
-    constants.SSHK_RSA: (rsa_private_file, rsa_public_file),
-    constants.SSHK_DSA: (dsa_private_file, dsa_public_file),
-    })
+  (auth_keys_file, keyfiles) = \
+    ssh.GetAllUserFiles(constants.SSH_LOGIN_USER, mkdir=True,
+                        _homedir_fn=_homedir_fn)
+
+  _UpdateKeyFiles(keys, dry_run, keyfiles)
 
   if dry_run:
     logging.info("This is a dry run, not modifying %s", auth_keys_file)
-- 
GitLab