From 9b6cc58b7f6999cb6c17929c086359f9c0d0522b Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Fri, 12 Jun 2015 08:14:18 -0700 Subject: [PATCH] fix(builder): call ls rather than using a wildcard The wildcard caused an off-by-one error where if no git repositories existed, the wildcard was then interpreted, causing all images prefixed with the registry IP address to be removed inside builder. As an example: $ for repo in *.git; do echo $repo; done *.git $ for repo in $(ls | grep .git); do echo $repo; done $ mkdir foo.git $ for repo in *.git; do echo $repo; done foo.git $ for repo in $(ls | grep .git); do echo $repo; done foo.git --- builder/rootfs/etc/confd/templates/check-repos | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/rootfs/etc/confd/templates/check-repos b/builder/rootfs/etc/confd/templates/check-repos index 669eb961b2..59acc59e50 100644 --- a/builder/rootfs/etc/confd/templates/check-repos +++ b/builder/rootfs/etc/confd/templates/check-repos @@ -4,7 +4,7 @@ export ETCD=${ETCD:-$HOST:4001} cd $(dirname $0) # absolute path -for repo in *.git +for repo in $(ls | grep .git) do reponame="${repo%.*}" if ! etcdctl -C $ETCD ls /deis/services/"$reponame" > /dev/null 2>&1