aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorGary Wu <gary.i.wu@huawei.com>2018-10-02 10:51:09 -0700
committerGary Wu <gary.i.wu@huawei.com>2018-10-02 10:51:09 -0700
commit133c664f7e58e8fb6e7c2b28947b8ba8173d5edf (patch)
treeb80f55071b5cc22c19d0825389a129afc3af2d45 /test
parentece5858fa9b397be82059cfc763504294d885e83 (diff)
Clean up ONAP teardown script
Change-Id: I762d3fd9159a19a6986c15af7612a706ab34fedf Issue-ID: INT-586 Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
Diffstat (limited to 'test')
-rwxr-xr-xtest/ete/scripts/teardown-onap.sh36
1 files changed, 25 insertions, 11 deletions
diff --git a/test/ete/scripts/teardown-onap.sh b/test/ete/scripts/teardown-onap.sh
index 4dad43e8f..e6805ff9f 100755
--- a/test/ete/scripts/teardown-onap.sh
+++ b/test/ete/scripts/teardown-onap.sh
@@ -51,12 +51,22 @@ if [ "$full_deletion" = true ];then
sleep 10
# delete all instances
- openstack server delete $(openstack server list -c ID -f value --project $OS_PROJECT_ID)
- sleep 1
+ SERVERS=$(openstack server list -c ID -f value --project $OS_PROJECT_ID)
+ if [ $? -ne 0 ]; then
+ # only admin roles support --project parameter, so retry without it if the above returns an error
+ SERVERS=$(openstack server list -c ID -f value)
+ fi
+ if [ ! -z "$SERVERS" ]; then
+ openstack server delete $SERVERS
+ sleep 1
+ fi
# miscellaneous cleanup
- openstack floating ip delete $(openstack floating ip list -c ID -f value --project $OS_PROJECT_ID)
- sleep 1
+ FLOATING_IPS=$(openstack floating ip list -c ID -f value --project $OS_PROJECT_ID)
+ if [ ! -z "$FLOATING_IPS" ]; then
+ openstack floating ip delete $FLOATING_IPS
+ sleep 1
+ fi
ROUTERS=$(openstack router list -c ID -f value --project $OS_PROJECT_ID)
echo $ROUTERS
@@ -68,15 +78,19 @@ if [ "$full_deletion" = true ];then
done
openstack router delete $ROUTER
done
-
- openstack port delete $(openstack port list -f value -c ID --project $OS_PROJECT_ID)
- openstack volume delete $(openstack volume list -f value -c ID --project $OS_PROJECT_ID)
-
- # delete all except "default" security group
- SECURITY_GROUPS=$(openstack security group list -c ID -f value --project $OS_PROJECT_ID | grep -v default)
- openstack security group delete $SECURITY_GROUPS
sleep 1
+ PORTS=$(openstack port list -f value -c ID --project $OS_PROJECT_ID)
+ if [ ! -z "$PORTS" ]; then
+ openstack port delete $PORTS
+ sleep 1
+ fi
+ VOLUMES=$(openstack volume list -f value -c ID --project $OS_PROJECT_ID)
+ if [ ! -z "$VOLUMES" ]; then
+ openstack volume delete $VOLUMES
+ sleep 1
+ fi
+
# Delete all existing stacks
STACKS=$(openstack stack list -c "Stack Name" -f value)