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
This commit is contained in:
Tomas Sedovic
2016-09-06 16:46:40 +02:00
parent 6c39473ce5
commit d70806559c

View File

@@ -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