Browse code

Fix is_keystone_enabled()

is_keystone_enabled() was calling is_service_enabled(), which is what called
is_keystone_enabled() in the first place. Make it work as designed and
also change calls to use the full service name. Note that this is all
still comptible with the prior usage of 'is_service_enabled key'.

Change-Id: I9c28377ecf074b7996461d2a4ca12d88dfc4d47e

Dean Troyer authored on 2015/02/13 13:18:33
Showing 5 changed files
... ...
@@ -1817,7 +1817,6 @@ function is_service_enabled {
1817 1817
         [[ ${service} == "trove" && ${ENABLED_SERVICES} =~ "tr-" ]] && enabled=0
1818 1818
         [[ ${service} == "swift" && ${ENABLED_SERVICES} =~ "s-" ]] && enabled=0
1819 1819
         [[ ${service} == s-* && ${ENABLED_SERVICES} =~ "swift" ]] && enabled=0
1820
-        [[ ${service} == key-* && ${ENABLED_SERVICES} =~ "key" ]] && enabled=0
1821 1820
     done
1822 1821
     $xtrace
1823 1822
     return $enabled
... ...
@@ -111,8 +111,17 @@ KEYSTONE_SERVICE_URI=${KEYSTONE_SERVICE_PROTOCOL}://${KEYSTONE_SERVICE_HOST}:${K
111 111
 KEYSTONE_AUTH_URI_V3=$KEYSTONE_AUTH_URI/v3
112 112
 KEYSTONE_SERVICE_URI_V3=$KEYSTONE_SERVICE_URI/v3
113 113
 
114
+
114 115
 # Functions
115 116
 # ---------
117
+
118
+# Test if Keystone is enabled
119
+# is_keystone_enabled
120
+function is_keystone_enabled {
121
+    [[ ,${ENABLED_SERVICES}, =~ ,"key", ]] && return 0
122
+    return 1
123
+}
124
+
116 125
 # cleanup_keystone() - Remove residual data files, anything left over from previous
117 126
 # runs that a clean run would need to clean up
118 127
 function cleanup_keystone {
... ...
@@ -576,9 +585,6 @@ function stop_keystone {
576 576
     stop_process key
577 577
 }
578 578
 
579
-function is_keystone_enabled {
580
-    return is_service_enabled key
581
-}
582 579
 
583 580
 # Restore xtrace
584 581
 $XTRACE
... ...
@@ -393,7 +393,7 @@ function configure_swift {
393 393
         swift_pipeline+=" swift3 s3token "
394 394
     fi
395 395
 
396
-    if is_service_enabled key;then
396
+    if is_service_enabled keystone; then
397 397
         swift_pipeline+=" authtoken keystoneauth"
398 398
     fi
399 399
     swift_pipeline+=" tempauth "
... ...
@@ -498,7 +498,7 @@ EOF
498 498
     iniset ${testfile} func_test password4 testing4
499 499
     iniset ${testfile} func_test domain4 swift_test
500 500
 
501
-    if is_service_enabled key;then
501
+    if is_service_enabled keystone; then
502 502
         iniuncomment ${testfile} func_test auth_version
503 503
         local auth_vers=$(iniget ${testfile} func_test auth_version)
504 504
         iniset ${testfile} func_test auth_host ${KEYSTONE_SERVICE_HOST}
... ...
@@ -601,7 +601,7 @@ fi
601 601
 
602 602
 # Keystone
603 603
 
604
-if is_service_enabled key; then
604
+if is_service_enabled keystone; then
605 605
     # The ``SERVICE_TOKEN`` is used to bootstrap the Keystone database.  It is
606 606
     # just a string and is not a 'real' Keystone token.
607 607
     read_password SERVICE_TOKEN "ENTER A SERVICE_TOKEN TO USE FOR THE SERVICE ADMIN TOKEN."
... ...
@@ -725,7 +725,7 @@ else
725 725
 fi
726 726
 
727 727
 
728
-if is_service_enabled key; then
728
+if is_service_enabled keystone; then
729 729
     if [ "$KEYSTONE_AUTH_HOST" == "$SERVICE_HOST" ]; then
730 730
         install_keystone
731 731
         configure_keystone
... ...
@@ -918,7 +918,7 @@ start_dstat
918 918
 # Keystone
919 919
 # --------
920 920
 
921
-if is_service_enabled key; then
921
+if is_service_enabled keystone; then
922 922
     echo_summary "Starting Keystone"
923 923
 
924 924
     if [ "$KEYSTONE_AUTH_HOST" == "$SERVICE_HOST" ]; then
... ...
@@ -1143,7 +1143,7 @@ if is_service_enabled g-reg; then
1143 1143
 fi
1144 1144
 
1145 1145
 # Create an access key and secret key for nova ec2 register image
1146
-if is_service_enabled key && is_service_enabled swift3 && is_service_enabled nova; then
1146
+if is_service_enabled keystone && is_service_enabled swift3 && is_service_enabled nova; then
1147 1147
     eval $(openstack ec2 credentials create --user nova --project $SERVICE_TENANT_NAME -f shell -c access -c secret)
1148 1148
     iniset $NOVA_CONF DEFAULT s3_access_key "$access"
1149 1149
     iniset $NOVA_CONF DEFAULT s3_secret_key "$secret"
... ...
@@ -1226,7 +1226,7 @@ fi
1226 1226
 # This step also creates certificates for tenants and users,
1227 1227
 # which is helpful in image bundle steps.
1228 1228
 
1229
-if is_service_enabled nova && is_service_enabled key; then
1229
+if is_service_enabled nova && is_service_enabled keystone; then
1230 1230
     USERRC_PARAMS="-PA --target-dir $TOP_DIR/accrc"
1231 1231
 
1232 1232
     if [ -f $SSL_BUNDLE_FILE ]; then
... ...
@@ -1314,7 +1314,7 @@ if is_service_enabled horizon; then
1314 1314
 fi
1315 1315
 
1316 1316
 # If Keystone is present you can point ``nova`` cli to this server
1317
-if is_service_enabled key; then
1317
+if is_service_enabled keystone; then
1318 1318
     echo "Keystone is serving at $KEYSTONE_SERVICE_URI/v2.0/"
1319 1319
     echo "Examples on using novaclient command line is in exercise.sh"
1320 1320
     echo "The default users are: admin and demo"
... ...
@@ -112,7 +112,7 @@ if is_service_enabled glance; then
112 112
     stop_glance
113 113
 fi
114 114
 
115
-if is_service_enabled key; then
115
+if is_service_enabled keystone; then
116 116
     stop_keystone
117 117
 fi
118 118