From a565925b0f286a6fe82b4698b2a2196405e3f8e5 Mon Sep 17 00:00:00 2001
From: caoyuan <cao.yuan@99cloud.net>
Date: Mon, 20 Mar 2017 12:19:17 +0800
Subject: [PATCH] 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
---
 tools/cleanup-containers | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/cleanup-containers b/tools/cleanup-containers
index b48c2fc849..a6fee80ea7 100755
--- a/tools/cleanup-containers
+++ b/tools/cleanup-containers
@@ -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)
 
-- 
GitLab