From 57856a5584f10aba33e43733924f329c9772f3fc Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Tue, 30 Dec 2014 16:20:00 +0000 Subject: [PATCH 1/2] align script and image versions - released weave scripts run their corresponding image versions - unreleased weave scripts run the 'latest'-tagged image versions The image version to run can also be specified explicitly by setting VERSION. Useful for testing, mainly. --- weave | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/weave b/weave index 88fc10bd..63896dec 100755 --- a/weave +++ b/weave @@ -33,8 +33,16 @@ usage() { [ $# -gt 0 ] || usage -IMAGE=zettio/weave -DNS_IMAGE=zettio/weavedns +if [ "$SCRIPT_VERSION" = "(unreleased version)" ] ; then + IMAGE_VERSION=latest +else + IMAGE_VERSION=$SCRIPT_VERSION +fi + +IMAGE_VERSION=${VERSION:-$IMAGE_VERSION} + +IMAGE=zettio/weave:$IMAGE_VERSION +DNS_IMAGE=zettio/weavedns:$IMAGE_VERSION CONTAINER_NAME=weave DNS_CONTAINER_NAME=weavedns BRIDGE=weave From 24810799575c65a5f1449a72f53e51104ecfb254 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Tue, 30 Dec 2014 16:49:41 +0000 Subject: [PATCH 2/2] don't include image version when checking for existing containers So we complain with "already running" rather than "Found another running container" when encountering a 'weave' container running a different image version. Similarly, we remove stopped 'weave' containers regardless of version. Ditto for weavedns. Which is all how it used to work. --- weave | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/weave b/weave index 63896dec..8179f930 100755 --- a/weave +++ b/weave @@ -41,8 +41,10 @@ fi IMAGE_VERSION=${VERSION:-$IMAGE_VERSION} -IMAGE=zettio/weave:$IMAGE_VERSION -DNS_IMAGE=zettio/weavedns:$IMAGE_VERSION +BASE_IMAGE=zettio/weave +BASE_DNS_IMAGE=zettio/weavedns +IMAGE=$BASE_IMAGE:$IMAGE_VERSION +DNS_IMAGE=$BASE_DNS_IMAGE:$IMAGE_VERSION CONTAINER_NAME=weave DNS_CONTAINER_NAME=weavedns BRIDGE=weave @@ -366,9 +368,16 @@ check_not_running() { echo "$1 is already running." >&2 exit 1 ;; + "true $2:"*) + echo "$1 is already running." >&2 + exit 1 + ;; "false $2") docker rm $1 >/dev/null ;; + "false $2:"*) + docker rm $1 >/dev/null + ;; true*) echo "Found another running container named '$1'. Aborting." >&2 exit 1 @@ -437,7 +446,7 @@ DOCKER_VERSION_PATCH=$(echo "$DOCKER_VERSION" | cut -d. -f 3) case "$COMMAND" in launch) - check_not_running $CONTAINER_NAME $IMAGE + check_not_running $CONTAINER_NAME $BASE_IMAGE create_bridge # We set the router name to the bridge mac since that is # stable across re-creations of the containers. @@ -474,7 +483,7 @@ case "$COMMAND" in [ $# -gt 0 ] || usage CIDR=$1 shift 1 - check_not_running $DNS_CONTAINER_NAME $DNS_IMAGE + check_not_running $DNS_CONTAINER_NAME $BASE_DNS_IMAGE create_bridge docker_bridge_ip DNS_CONTAINER=$(docker run --privileged -d --name=$DNS_CONTAINER_NAME \