summaryrefslogtreecommitdiffstats
path: root/test/ete
diff options
context:
space:
mode:
Diffstat (limited to 'test/ete')
-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)