From 64a9b893947329028bf0ef57379372e7d0de43e9 Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Tue, 29 Aug 2017 02:35:37 +0200 Subject: lib.sh: Reuse /tmp/mcp.rsa if present Long-term, /tmp/mcp.rsa should be moved to a persistent location [1], and made configurable via env var / other mechanisms. This will allow us to: - use an existing keypair (provided by end-user in expected path); - login to previous deployment machines (e.g. to cleanup UEFI boot entries before destroying the cluster and rebuilding it); - split deploy in re-entrant stages (salt master only, cluster nodes only; similar to old Fuel, where we could reuse old Fuel VM); [1] https://jira.opnfv.org/browse/FUEL-280 Change-Id: I1e53321ed1cfc217ff95e809c867fa3370c479c9 Signed-off-by: Alexandru Avadanii --- mcp/scripts/lib.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mcp/scripts/lib.sh b/mcp/scripts/lib.sh index 1b439a93e..3f740589d 100644 --- a/mcp/scripts/lib.sh +++ b/mcp/scripts/lib.sh @@ -9,6 +9,11 @@ generate_ssh_key() { user=${SUDO_USER} fi + if [ -f "/tmp/${SSH_KEY}" ]; then + cp "/tmp/${SSH_KEY}" . + ssh-keygen -f "${SSH_KEY}" -y > "${SSH_KEY}.pub" + fi + [ -f "${SSH_KEY}" ] || ssh-keygen -f "${SSH_KEY}" -N '' install -o "${user}" -m 0600 "${SSH_KEY}" /tmp/ } -- cgit 1.2.3-korg