Explicit check for DNS zone project ID in teardown 71/31871/3
authorGary Wu <gary.i.wu@huawei.com>
Thu, 15 Feb 2018 19:28:50 +0000 (11:28 -0800)
committerGary Wu <gary.i.wu@huawei.com>
Thu, 15 Feb 2018 19:35:31 +0000 (19:35 +0000)
TLAB Designate configuration currently does not support
project-specific DNS zones.  This modifies the teardown
script to avoid deleting such noauth-project DNS zones.

In practice this means that no TLAB DNS zones
will ever be deleted during teardown until TLAB
fixes its Designate configuration.

Change-Id: I43be641e4653270fd31b1a4daf9f16d4afee05ab
Issue-ID: INT-414
Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
test/ete/scripts/teardown-onap.sh

index dbbee28..3a40cfa 100755 (executable)
@@ -11,10 +11,13 @@ source $WORKSPACE/test/ete/scripts/install_openstack_cli.sh
 # $WORKSPACE/test/ete/scripts/dns-zones/delete-dns-zones.sh $OS_PROJECT_NAME
 # sleep 1
 
-# delete all Desigate DNS zones
+# delete all Desigate DNS zones belonging to this project
 ZONES=$(openstack zone list -c "id" -f value)
 for ZONE in ${ZONES}; do
-    openstack zone delete $ZONE
+    ZONE_PROJECT_ID=$(openstack zone show $ZONE -f json | jq -r '.project_id')
+    if [ "$OS_PROJECT_ID" == "$ZONE_PROJECT_ID" ]; then
+        openstack zone delete $ZONE
+    fi
 done
 
 # delete all instances
@@ -31,7 +34,7 @@ for ROUTER in $ROUTERS; do
     echo $ROUTER;
     PORTS=$(openstack router show $ROUTER  -c "interfaces_info" -f "value" | jq -r '.[].port_id')
     for PORT in $PORTS; do
-       openstack router remove port $ROUTER $PORT
+        openstack router remove port $ROUTER $PORT
     done
     openstack router delete $ROUTER
 done