From d70806559c7fdcec60f45e1780e39b39d9b224f7 Mon Sep 17 00:00:00 2001 From: Tomas Sedovic Date: Tue, 6 Sep 2016 16:46:40 +0200 Subject: [PATCH] Allow the validations to run openstack commands The "run_validation" mistral action passes the necessary credentials to authenticate against the undercloud OpenStack, but they're not in the format the openstack commandline client expects, which means that e.g. running "openstack server list" from the validation would fail. This sets the necessary environment variables such that the commands should mostly just work. Change-Id: Ie09a68bdcd8107399558f45f022480ef066e8c01 --- scripts/run-validation | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scripts/run-validation b/scripts/run-validation index 0c2d2c641..7b35f10cf 100755 --- a/scripts/run-validation +++ b/scripts/run-validation @@ -36,4 +36,16 @@ export ANSIBLE_INVENTORY=$(which tripleo-ansible-inventory) # dynamic inventory script export TRIPLEO_PLAN_NAME=${PLAN_NAME} +# NOTE(shadower): set up token-based environment for the openstack +# client when the password doesn't exist. This happens when called +# from mistral: +if [ -z "${OS_PASSWORD:-}" ]; then + # The auth type must be explicitly set to token + export OS_AUTH_TYPE=token + # The openstack client expects the token as OS_TOKEN + export OS_TOKEN=$OS_AUTH_TOKEN + # TODO(shadower): I could not get the token auth working with v3: + export OS_AUTH_URL=${OS_AUTH_URL/%v3/v2.0} +fi + ansible-playbook $VALIDATION_FILE