Fix the remove mariadb volume failed

- when run tools/cleanup-containers mariadb, the mariadb volume remove
failed, because the "volumes_to_remove" can't catch the mariadb
volume, this patch to fix it.

- remove the unnecessary "()"

more test infomation, see http://paste.openstack.org/show/603359/

Closes-Bug: #1674207

Change-Id: I82f5922fcc84d222f74d2551a2c697bf78136a2d
This commit is contained in:
caoyuan 2017-03-20 12:19:17 +08:00
parent 469eb14886
commit a565925b0f

View File

@ -11,9 +11,9 @@ if [[ "${containers_running}" =~ "nova_libvirt" ]] && [[ $QEMU_PIDS ]] && [[ $(p
fi
if [ -n "$1" ]; then
containers_to_kill=($(docker ps --filter "label=kolla_version" --format "{{.Names}}" -a | grep -E "$1" | awk '{print $1}'))
volumes_to_remove=($(docker inspect -f '{{range .Mounts}} {{printf "%s\n" .Name }}{{end}}' $1 | \
egrep -v '(^\s*$)' | sort | uniq))
containers_to_kill=$(docker ps --filter "label=kolla_version" --format "{{.Names}}" -a | grep -E "$1" | awk '{print $1}')
volumes_to_remove=$(docker inspect -f '{{range .Mounts}} {{printf "%s\n" .Name }}{{end}}' ${containers_to_kill} | \
egrep -v '(^\s*$)' | sort | uniq)
else
containers_to_kill=$(docker ps --filter "label=kolla_version" --format "{{.Names}}" -a)