]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Handle %(tenant_id)s in endpoints when updating
authorZane Bitter <zbitter@redhat.com>
Thu, 18 Oct 2012 14:50:53 +0000 (16:50 +0200)
committerZane Bitter <zbitter@redhat.com>
Mon, 22 Oct 2012 12:06:23 +0000 (14:06 +0200)
Change-Id: I61112f02b60b6bb63f33d5459edec1f44a49bdd5
Signed-off-by: Zane Bitter <zbitter@redhat.com>
bin/heat-keystone-setup

index 880a0f323e951c810178cdb957664a53fc136bb0..5d6fbc01ddde3d957331e2ce79681a6f0710193a 100755 (executable)
@@ -92,15 +92,18 @@ delete_endpoint() {
     local service_type=$1
 
     local url=$(get_data 1 "${service_type}[.]publicURL" 2 \
-                get_endpoint $service_type 2>/dev/null)
+                get_endpoint $service_type 2>/dev/null | \
+                    sed -e "s/${TENANT_ID}/%[(]tenant_id[)]s/")
 
     if [ -n "$url" ]; then
         local endpoints=$(get_data 3 $url 1 keystone endpoint-list)
 
         for endpoint in $endpoints; do
-            echo "Removing $service_type endpoint ${url}..." >&2
+            echo "Removing $service_type endpoint ${endpoint}..." >&2
             keystone endpoint-delete "$endpoint" >&2
         done
+
+        if [ -z "$endpoints" ]; then false; fi
     else
         false
     fi
@@ -147,6 +150,7 @@ add_endpoint() {
 }
 
 
+TENANT_ID=$(get_data 1 tenant_id 2 keystone token-get)
 set_admin_token
 
 ADMIN_ROLE=$(get_data 2 admin 1 keystone role-list)
@@ -169,4 +173,4 @@ HEAT_CFN_SERVICE=$(get_service heat-cfn cloudformation \
                    "Heat CloudFormation API")
 add_endpoint $HEAT_CFN_SERVICE 'http://localhost:8000/v1'
 
-delete_all_endpoints orchestration
+delete_service orchestration