Enhance cleanup script

There is need to remove airshipctl artifacts in /tmp/airship,
docker containers/images and left processes which use port 8000 or 8099.

Change-Id: I682cf5a6f41875d5be77aa552e4743c9b8cf17df
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
This commit is contained in:
Ruslan Aliev 2020-09-16 12:00:59 -05:00
parent 30914340da
commit 9751968fa8

View File

@ -14,9 +14,10 @@
set -x
sudo rm -rf ~/.airship/ ~/.ansible.cfg /srv/iso/*
sudo rm -rf ~/.airship/ ~/.ansible.cfg /srv/iso/* /tmp/airship/
sudo service sushy-tools stop
sudo service apache2 stop
sudo kill -9 $(lsof -t -i:8000 -i:8099)
vm_types='ephemeral|target|worker'
@ -29,3 +30,8 @@ for vm in $vm_list; do sudo virsh destroy $vm; sudo virsh undefine $vm --nvram -
for vol in $vol_list; do sudo virsh vol-delete $vol --pool airship; done
for iso in $iso_list; do sudo virsh vol-delete $iso --pool default; done
for net in $net_list; do sudo virsh net-destroy $net; sudo virsh net-undefine $net; done
# TODO (raliev) the following commands can be overwritten in this way once we have proper label on all related containers/images
# docker rmi -f $(docker ls -q --all --filter "label=org.opencontainers.image.authors=airship-discuss@lists.airshipit.org, irc://#airshipit@freenode")
sudo docker rm -f -v $(sudo docker ps --all -q | xargs -I{} sudo bash -c 'if docker inspect {} | grep -q airship; then echo {} ; fi')
sudo docker rmi -f $(sudo docker images --all -q | xargs -I{} sudo bash -c 'if docker image inspect {} | grep -q airship; then echo {} ; fi')