diff options
author | Alexandru Avadanii <Alexandru.Avadanii@enea.com> | 2017-08-29 02:35:37 +0200 |
---|---|---|
committer | Alexandru Avadanii <Alexandru.Avadanii@enea.com> | 2017-08-29 21:38:26 +0200 |
commit | 64a9b893947329028bf0ef57379372e7d0de43e9 (patch) | |
tree | fba9c59fcec284698bff91041141d2552a3594e5 /mcp/scripts | |
parent | db6e94bc05ad30de2151c2e1ee1dc4fc164f012e (diff) |
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 <Alexandru.Avadanii@enea.com>
Diffstat (limited to 'mcp/scripts')
-rw-r--r-- | mcp/scripts/lib.sh | 5 |
1 files changed, 5 insertions, 0 deletions
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/ } |