Browse code

Make configurable the creation of heat stack domain

Heat has graceful fallback code if stack_user_domain is not configured.

It is important that this be configurable, for testing and for those who choose to
not run with a stack_user_domain yet.

Change-Id: I08f017412636327853b3c606afd36ae93aa09288

Steve Baker authored on 2014/03/11 10:01:57
Showing 1 changed files
... ...
@@ -37,6 +37,7 @@ HEAT_CONF_DIR=/etc/heat
37 37
 HEAT_CONF=$HEAT_CONF_DIR/heat.conf
38 38
 HEAT_ENV_DIR=$HEAT_CONF_DIR/environment.d
39 39
 HEAT_TEMPLATES_DIR=$HEAT_CONF_DIR/templates
40
+HEAT_STACK_DOMAIN=`trueorfalse True $HEAT_STACK_DOMAIN`
40 41
 
41 42
 # Tell Tempest this project is present
42 43
 TEMPEST_SERVICES+=,heat
... ...
@@ -253,24 +254,26 @@ function create_heat_accounts {
253 253
     openstack role add $HEAT_OWNER_ROLE --project demo --user admin
254 254
     openstack role add $HEAT_OWNER_ROLE --project admin --user admin
255 255
 
256
-    # Note we have to pass token/endpoint here because the current endpoint and
257
-    # version negotiation in OSC means just --os-identity-api-version=3 won't work
258
-    KS_ENDPOINT_V3="$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/v3"
259
-    D_ID=$(openstack --os-token $OS_TOKEN --os-url=$KS_ENDPOINT_V3 \
260
-        --os-identity-api-version=3 domain create heat \
261
-        --description "Owns users and projects created by heat" \
262
-        | grep ' id ' | get_field 2)
263
-    iniset $HEAT_CONF DEFAULT stack_user_domain ${D_ID}
264
-
265
-    openstack --os-token $OS_TOKEN --os-url=$KS_ENDPOINT_V3 \
266
-        --os-identity-api-version=3 user create --password $SERVICE_PASSWORD \
267
-        --domain $D_ID heat_domain_admin \
268
-        --description "Manages users and projects created by heat"
269
-    openstack --os-token $OS_TOKEN --os-url=$KS_ENDPOINT_V3 \
270
-        --os-identity-api-version=3 role add \
271
-        --user heat_domain_admin --domain ${D_ID} admin
272
-    iniset $HEAT_CONF DEFAULT stack_domain_admin heat_domain_admin
273
-    iniset $HEAT_CONF DEFAULT stack_domain_admin_password $SERVICE_PASSWORD
256
+    if [[ "$HEAT_STACK_DOMAIN" == "True" ]]; then
257
+        # Note we have to pass token/endpoint here because the current endpoint and
258
+        # version negotiation in OSC means just --os-identity-api-version=3 won't work
259
+        KS_ENDPOINT_V3="$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/v3"
260
+        D_ID=$(openstack --os-token $OS_TOKEN --os-url=$KS_ENDPOINT_V3 \
261
+            --os-identity-api-version=3 domain create heat \
262
+            --description "Owns users and projects created by heat" \
263
+            | grep ' id ' | get_field 2)
264
+        iniset $HEAT_CONF DEFAULT stack_user_domain ${D_ID}
265
+
266
+        openstack --os-token $OS_TOKEN --os-url=$KS_ENDPOINT_V3 \
267
+            --os-identity-api-version=3 user create --password $SERVICE_PASSWORD \
268
+            --domain $D_ID heat_domain_admin \
269
+            --description "Manages users and projects created by heat"
270
+        openstack --os-token $OS_TOKEN --os-url=$KS_ENDPOINT_V3 \
271
+            --os-identity-api-version=3 role add \
272
+            --user heat_domain_admin --domain ${D_ID} admin
273
+        iniset $HEAT_CONF DEFAULT stack_domain_admin heat_domain_admin
274
+        iniset $HEAT_CONF DEFAULT stack_domain_admin_password $SERVICE_PASSWORD
275
+    fi
274 276
 }
275 277
 
276 278
 # Restore xtrace