fix(rally): update cleanup

The cleanup script used for router, network, server, and flavor does not
account for the first column being the resource ID. Matching via
^[sc]_rally will always result in an empty return. This fix now correctly
matches the the name of the second column. This also fixes an issue where
rally creates flavor as "private", adding --all so it cleans up the
private flavors as well.

Change-Id: Id1a0e31e56b51fd92a95e8588d259ce21fa839d6
Signed-off-by: Tin Lam <tin@irrational.io>
This commit is contained in:
Tin Lam 2020-05-07 10:38:56 -05:00
parent 9a2dd2f153
commit 6d35251cf1
2 changed files with 4 additions and 4 deletions

View File

@ -793,11 +793,11 @@ conf:
force_project_purge: false force_project_purge: false
run_tempest: false run_tempest: false
clean_up: | clean_up: |
ROUTERS=$(openstack router list -f value | grep -e "^[sc]_rally_" | awk '{ print $1 }') ROUTERS=$(openstack router list -f value | awk '$2 ~ /^[sc]_rally_/ { print $1 }')
if [ -n "$ROUTERS" ]; then if [ -n "$ROUTERS" ]; then
echo $ROUTERS | xargs openstack router delete echo $ROUTERS | xargs openstack router delete
fi fi
NETWORKS=$(openstack network list -f value | grep -e "^[sc]_rally_" | awk '{ print $1 }') NETWORKS=$(openstack network list -f value | awk '$2 ~ /^[sc]_rally_/ { print $1 }')
if [ -n "$NETWORKS" ]; then if [ -n "$NETWORKS" ]; then
echo $NETWORKS | xargs openstack network delete echo $NETWORKS | xargs openstack network delete
fi fi

View File

@ -617,11 +617,11 @@ conf:
rally_tests: rally_tests:
run_tempest: false run_tempest: false
clean_up: | clean_up: |
FLAVORS=$(openstack flavor list -f value | grep -e "^s_rally_" | awk '{ print $1 }') FLAVORS=$(openstack flavor list -f value --all | awk '$2 ~ /^s_rally_/ { print $1 }')
if [ -n "$FLAVORS" ]; then if [ -n "$FLAVORS" ]; then
echo $FLAVORS | xargs openstack flavor delete echo $FLAVORS | xargs openstack flavor delete
fi fi
SERVERS=$(openstack server list -f value | grep -e "^s_rally_" | awk '{ print $1 }') SERVERS=$(openstack server list -f value --all | awk '$2 ~ /^s_rally_/ { print $1 }')
if [ -n "$SERVERS" ]; then if [ -n "$SERVERS" ]; then
echo $SERVERS | xargs openstack server delete echo $SERVERS | xargs openstack server delete
fi fi