From: Thierry Parmentelat Date: Sun, 1 Apr 2012 13:12:05 +0000 (+0200) Subject: vtest-init-lxc is more strict when checking if container already exists X-Git-Tag: 5.0-rc27~68 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=714503fed307a5a8fff3eed75b99d6025d73a334;p=build.git vtest-init-lxc is more strict when checking if container already exists --- diff --git a/vbuild-init-lxc.sh b/vbuild-init-lxc.sh index 82db67ef..fa7d1a1e 100755 --- a/vbuild-init-lxc.sh +++ b/vbuild-init-lxc.sh @@ -860,11 +860,9 @@ function main () { # need lxc installed before we can run lxc-ls prepare_host - if [ ! -z "$(lxc-ls | grep $lxc)" ];then - echo "container $lxc exists" - exit 1 - fi - + # be strict on lxc-lines matching name exactly using ^$ + # as otherwise the timestamps may show up here + lxc-ls | grep -q '^'"$lxc"'$' && { echo "container $lxc already exists - exiting" ; exit 1 ; } path=/var/lib/lxc rootfs_path=$path/$lxc/rootfs