diff options
author | Lingxian Kong <anlin.kong@gmail.com> | 2019-08-28 16:07:07 +1200 |
---|---|---|
committer | Lingxian Kong <anlin.kong@gmail.com> | 2019-08-29 15:41:58 +1200 |
commit | 0ef474a70ce3d6ba15c19240425f2ac48d12e778 (patch) | |
tree | 663156df263121956e2aa8d37380e63dfe99ea36 /integration/scripts | |
parent | 259e0f6f093ec5397a778bd485379e2532b4cc5f (diff) | |
download | trove-0ef474a70ce3d6ba15c19240425f2ac48d12e778.tar.gz |
Support keypair in devstack
Since Trove already supports to specify a Nova keypair when creating
instance for management convenience, devstack needs to be changed to
create the management keypair and add to Trove config file.
One extra change in this patch is to use a single config file for Trove
API, task-manager and conductor.
Change-Id: I1e6c4f4305104815bdf89b31776a4955de61bc89
Story: 2005429
Task: 30463
Diffstat (limited to 'integration/scripts')
4 files changed, 14 insertions, 25 deletions
diff --git a/integration/scripts/files/elements/ubuntu-guest/extra-data.d/62-ssh-key b/integration/scripts/files/elements/ubuntu-guest/extra-data.d/62-ssh-key index 63453a75..894950db 100755 --- a/integration/scripts/files/elements/ubuntu-guest/extra-data.d/62-ssh-key +++ b/integration/scripts/files/elements/ubuntu-guest/extra-data.d/62-ssh-key @@ -12,20 +12,16 @@ set -o xtrace source $_LIB/die [ -n "$TMP_HOOKS_PATH" ] || die "Temp hook path not set" - [ -n "${HOST_USERNAME}" ] || die "HOST_USERNAME needs to be set to the user for the current user on the host" if [ `whoami` = "root" ]; then die "This should not be run as root" fi -# copy files over the "staging" area for the guest image (they'll later be put in the correct location by the guest user -# not these keys should not be overridden otherwise a) you won't be able to ssh in and b) the guest won't be able to -# rsync the files -if [ -e ${SSH_DIR}/authorized_keys ]; then - sudo -Hiu ${HOST_USERNAME} dd if=${SSH_DIR}/authorized_keys of=${TMP_HOOKS_PATH}/ssh-authorized-keys +# Guest agent needs to ssh into the controller to download code in dev mode. +if [ -e ${SSH_DIR}/id_rsa ]; then sudo -Hiu ${HOST_USERNAME} dd if=${SSH_DIR}/id_rsa of=${TMP_HOOKS_PATH}/id_rsa sudo -Hiu ${HOST_USERNAME} dd if=${SSH_DIR}/id_rsa.pub of=${TMP_HOOKS_PATH}/id_rsa.pub else - die "SSH Authorized Keys file must exist along with pub and private key" + die "SSH keys must exist" fi diff --git a/integration/scripts/files/elements/ubuntu-guest/install.d/62-ssh-key b/integration/scripts/files/elements/ubuntu-guest/install.d/62-ssh-key index 24a8013e..21a54d28 100755 --- a/integration/scripts/files/elements/ubuntu-guest/install.d/62-ssh-key +++ b/integration/scripts/files/elements/ubuntu-guest/install.d/62-ssh-key @@ -9,19 +9,16 @@ set -o xtrace SSH_DIR="/home/${GUEST_USERNAME}/.ssh" TMP_HOOKS_DIR="/tmp/in_target.d" -if [ -e "${TMP_HOOKS_DIR}/ssh-authorized-keys" ]; then - if [ ! -e ${SSH_DIR} ]; then - # this method worked more reliable in vmware fusion over doing sudo -Hiu ${GUEST_USERNAME} - mkdir ${SSH_DIR} - chown ${GUEST_USERNAME}:${GUEST_USERNAME} ${SSH_DIR} - fi - sudo -Hiu ${GUEST_USERNAME} dd of=${SSH_DIR}/authorized_keys conv=notrunc if=${TMP_HOOKS_DIR}/ssh-authorized-keys - if [ ! -e "${SSH_DIR}/id_rsa" ]; then - sudo -Hiu ${GUEST_USERNAME} dd of=${SSH_DIR}/id_rsa if=${TMP_HOOKS_DIR}/id_rsa - # perms have to be right on this file for ssh to work - sudo -Hiu ${GUEST_USERNAME} chmod 600 ${SSH_DIR}/id_rsa - sudo -Hiu ${GUEST_USERNAME} dd of=${SSH_DIR}/id_rsa.pub if=${TMP_HOOKS_DIR}/id_rsa.pub - fi +if [ ! -e ${SSH_DIR} ]; then + # this method worked more reliable in vmware fusion over doing sudo -Hiu ${GUEST_USERNAME} + mkdir ${SSH_DIR} + chown ${GUEST_USERNAME}:${GUEST_USERNAME} ${SSH_DIR} +fi + +if [ -e "${TMP_HOOKS_DIR}/id_rsa" ]; then + sudo -Hiu ${GUEST_USERNAME} dd of=${SSH_DIR}/id_rsa.pub if=${TMP_HOOKS_DIR}/id_rsa.pub + sudo -Hiu ${GUEST_USERNAME} dd of=${SSH_DIR}/id_rsa if=${TMP_HOOKS_DIR}/id_rsa + sudo -Hiu ${GUEST_USERNAME} chmod 600 ${SSH_DIR}/id_rsa else echo "SSH Keys were not staged by host" exit -1 diff --git a/integration/scripts/functions_qemu b/integration/scripts/functions_qemu index cf839248..a708a765 100644 --- a/integration/scripts/functions_qemu +++ b/integration/scripts/functions_qemu @@ -125,9 +125,7 @@ function clean_instances() { for i in $LIST; do sudo virsh destroy $i; done } -# Trove doesn't support to specify keypair when creating the db instance, the -# ssh keys are injected when the image is built. This could be removed when -# we support keypair in the future. +# In dev mode, guest agent needs to ssh into the controller to download code. function manage_ssh_keys() { if [ -d ${SSH_DIR} ]; then echo "${SSH_DIR} already exists" diff --git a/integration/scripts/trovestack b/integration/scripts/trovestack index f629cab4..28362386 100755 --- a/integration/scripts/trovestack +++ b/integration/scripts/trovestack @@ -79,8 +79,6 @@ export RELEASE=${RELEASE:-$DISTRO_RELEASE} # Set up variables for the CONF files - this has to happen after loading trovestack.rc, since # TROVE_CONF_DIR is defined there - these will be used by devstack too export TROVE_CONF=$TROVE_CONF_DIR/trove.conf -export TROVE_TASKMANAGER_CONF=$TROVE_CONF_DIR/trove-taskmanager.conf -export TROVE_CONDUCTOR_CONF=$TROVE_CONF_DIR/trove-conductor.conf export TROVE_GUESTAGENT_CONF=$TROVE_CONF_DIR/trove-guestagent.conf export TROVE_API_PASTE_INI=$TROVE_CONF_DIR/api-paste.ini export TEST_CONF=$TROVE_CONF_DIR/test.conf |