devstack doesn't check ASTARA_APPLIANCE_SSH_PUBLIC_KEY existence

Change plugin from "source" to mode "stack" and phase "pre-install" to generate the default ssh keypair.

Change-Id: Ie52095db3342cfa01114a2fd1c67220b9edf9626
Closes-Bug: #1531723
This commit is contained in:
zhang sheng 2016-01-07 14:16:35 +08:00
parent 7a69eb0f7e
commit 35ffb2cf51
1 changed files with 8 additions and 9 deletions

View File

@ -328,20 +328,19 @@ function set_demo_tenant_sec_group_private_traffic() {
}
function check_prereqs() {
# Fail devstack as early as possible if system does not satisfy some known
# prerequisites
if [ ! -e "$ASTARA_APPLIANCE_SSH_PUBLIC_KEY" ]; then
die $LINENO "Public SSH key not found at $ASTARA_APPLIANCE_SSH_PUBLIC_KEY. Please copy one there or " \
"set ASTARA_APPLIANCE_SSH_PUBLIC_KEY accordingly."
function configure_astara_ssh_keypair {
if [[ ! -e $ASTARA_APPLIANCE_SSH_PUBLIC_KEY ]]; then
if [[ ! -d $(dirname $ASTARA_APPLIANCE_SSH_PUBLIC_KEY) ]]; then
mkdir -p $(dirname $ASTARA_APPLIANCE_SSH_PUBLIC_KEY)
fi
echo -e 'n\n' | ssh-keygen -q -t rsa -P '' -f ${ASTARA_APPLIANCE_SSH_PUBLIC_KEY%.*}
fi
}
if is_service_enabled astara; then
if [[ "$1" == "source" ]]; then
check_prereqs
if [[ "$1" == "stack" && "$2" == "pre-install" ]]; then
configure_astara_ssh_keypair
elif [[ "$1" == "stack" && "$2" == "install" ]]; then
echo_summary "Installing Astara"