Browse code

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

Matthew Treinish authored on 2016/03/26 08:39:43
Showing 1 changed files
... ...
@@ -325,6 +325,24 @@ function configure_tempest {
325 325
     if [[ "$OFFLINE" != "True" ]]; then
326 326
         tox -revenv --notest
327 327
     fi
328
+
329
+    # Auth
330
+    iniset $TEMPEST_CONFIG auth tempest_roles "Member"
331
+    if [[ $TEMPEST_USE_TEST_ACCOUNTS == "True" ]]; then
332
+        if [[ $TEMPEST_HAS_ADMIN == "True" ]]; then
333
+            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
334
+        else
335
+            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
336
+        fi
337
+        iniset $TEMPEST_CONFIG auth use_dynamic_credentials False
338
+        iniset $TEMPEST_CONFIG auth test_accounts_file "etc/accounts.yaml"
339
+    elif [[ $TEMPEST_HAS_ADMIN == "False" ]]; then
340
+        iniset $TEMPEST_CONFIG auth use_dynamic_credentials ${TEMPEST_ALLOW_TENANT_ISOLATION:-False}
341
+
342
+    else
343
+        iniset $TEMPEST_CONFIG auth use_dynamic_credentials ${TEMPEST_ALLOW_TENANT_ISOLATION:-True}
344
+    fi
345
+
328 346
     # NOTE(mtreinish): Respect constraints on tempest verify-config venv
329 347
     tox -evenv -- pip install -c $REQUIREMENTS_DIR/upper-constraints.txt -r requirements.txt
330 348
     tox -evenv -- tempest verify-config -uro $tmp_cfg_file
... ...
@@ -553,23 +571,6 @@ function configure_tempest {
553 553
         iniset $TEMPEST_CONFIG service_available cinder "False"
554 554
     fi
555 555
 
556
-    # Auth
557
-    iniset $TEMPEST_CONFIG auth tempest_roles "Member"
558
-    if [[ $TEMPEST_USE_TEST_ACCOUNTS == "True" ]]; then
559
-        if [[ $TEMPEST_HAS_ADMIN == "True" ]]; then
560
-            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
561
-        else
562
-            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
563
-        fi
564
-        iniset $TEMPEST_CONFIG auth use_dynamic_credentials False
565
-        iniset $TEMPEST_CONFIG auth test_accounts_file "etc/accounts.yaml"
566
-    elif [[ $TEMPEST_HAS_ADMIN == "False" ]]; then
567
-        iniset $TEMPEST_CONFIG auth use_dynamic_credentials ${TEMPEST_ALLOW_TENANT_ISOLATION:-False}
568
-
569
-    else
570
-        iniset $TEMPEST_CONFIG auth use_dynamic_credentials ${TEMPEST_ALLOW_TENANT_ISOLATION:-True}
571
-    fi
572
-
573 556
     # Restore IFS
574 557
     IFS=$ifs
575 558
 }