From 0948ab90ae2097da2d9e4f401cda3698e32621f4 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Fri, 25 Mar 2016 19:39:43 -0400 Subject: [PATCH] Move auth setup earlier in tempest config This commit moves the auth setup for tempest config to occur before we run tempest verify-config. The API requests that command runs require auth and in the case we run tempest without admin creds set the config file will not have any credentials to run the query with. By moving the auth setup to occur before this it will ensure tempest is always configured with credentials before we run the command. Change-Id: I6d11b24e4492f1fde3aa3a7a239c40d63111bfa1 --- lib/tempest | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/lib/tempest b/lib/tempest index 19b63d18da..ed26cafe2c 100644 --- a/lib/tempest +++ b/lib/tempest @@ -325,6 +325,24 @@ function configure_tempest { if [[ "$OFFLINE" != "True" ]]; then tox -revenv --notest fi + + # Auth + iniset $TEMPEST_CONFIG auth tempest_roles "Member" + if [[ $TEMPEST_USE_TEST_ACCOUNTS == "True" ]]; then + if [[ $TEMPEST_HAS_ADMIN == "True" ]]; then + tempest-account-generator -c $TEMPEST_CONFIG --os-username $admin_username --os-password "$password" --os-tenant-name $admin_tenant_name -r $TEMPEST_CONCURRENCY --with-admin etc/accounts.yaml + else + tempest-account-generator -c $TEMPEST_CONFIG --os-username $admin_username --os-password "$password" --os-tenant-name $admin_tenant_name -r $TEMPEST_CONCURRENCY etc/accounts.yaml + fi + iniset $TEMPEST_CONFIG auth use_dynamic_credentials False + iniset $TEMPEST_CONFIG auth test_accounts_file "etc/accounts.yaml" + elif [[ $TEMPEST_HAS_ADMIN == "False" ]]; then + iniset $TEMPEST_CONFIG auth use_dynamic_credentials ${TEMPEST_ALLOW_TENANT_ISOLATION:-False} + + else + iniset $TEMPEST_CONFIG auth use_dynamic_credentials ${TEMPEST_ALLOW_TENANT_ISOLATION:-True} + fi + # NOTE(mtreinish): Respect constraints on tempest verify-config venv tox -evenv -- pip install -c $REQUIREMENTS_DIR/upper-constraints.txt -r requirements.txt tox -evenv -- tempest verify-config -uro $tmp_cfg_file @@ -553,23 +571,6 @@ function configure_tempest { iniset $TEMPEST_CONFIG service_available cinder "False" fi - # Auth - iniset $TEMPEST_CONFIG auth tempest_roles "Member" - if [[ $TEMPEST_USE_TEST_ACCOUNTS == "True" ]]; then - if [[ $TEMPEST_HAS_ADMIN == "True" ]]; then - tempest-account-generator -c $TEMPEST_CONFIG --os-username $admin_username --os-password "$password" --os-tenant-name $admin_tenant_name -r $TEMPEST_CONCURRENCY --with-admin etc/accounts.yaml - else - tempest-account-generator -c $TEMPEST_CONFIG --os-username $admin_username --os-password "$password" --os-tenant-name $admin_tenant_name -r $TEMPEST_CONCURRENCY etc/accounts.yaml - fi - iniset $TEMPEST_CONFIG auth use_dynamic_credentials False - iniset $TEMPEST_CONFIG auth test_accounts_file "etc/accounts.yaml" - elif [[ $TEMPEST_HAS_ADMIN == "False" ]]; then - iniset $TEMPEST_CONFIG auth use_dynamic_credentials ${TEMPEST_ALLOW_TENANT_ISOLATION:-False} - - else - iniset $TEMPEST_CONFIG auth use_dynamic_credentials ${TEMPEST_ALLOW_TENANT_ISOLATION:-True} - fi - # Restore IFS IFS=$ifs }