Merge "Enhance cleanup script"

This commit is contained in:
Zuul 2020-09-30 14:40:39 +00:00 committed by Gerrit Code Review
commit e7866285f5

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')