From abf13c70260269cbf9014246f0cb35dc7f4758c0 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Tue, 22 Sep 2015 15:57:45 +0100 Subject: [PATCH] Simplify detection of issues --- weave | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/weave b/weave index 4b132a4e..5b1cf5fe 100755 --- a/weave +++ b/weave @@ -919,8 +919,9 @@ ipam_cidrs() { if [ "$IPAM_CIDRS" = "404 page not found" ] ; then echo "No IP address supplied (use the -iprange option on 'weave launch' to enable IP address allocation)" >&2 return 1 - elif [ "$IPAM_CIDRS" = "cancelled" ] ; then - return 0 + elif ! is_cidr "$IPAM_CIDRS" ; then + echo "$IPAM_CIDRS" >&2 + return 1 fi ALL_CIDRS="$IPAM_CIDRS" fi @@ -935,8 +936,6 @@ ipam_cidrs() { if [ "$CIDR" = "404 page not found" ] ; then echo "IP address allocation must be enabled to use 'net:'" >&2 return 1 - elif [ "$CIDR" = "cancelled" ] ; then - return 0 elif ! is_cidr "$CIDR" ; then echo "$CIDR" >&2 return 1 @@ -1489,10 +1488,6 @@ case "$COMMAND" in CONTAINER=$(container_id $1) create_bridge ipam_cidrs$ATTACH_TYPE $CONTAINER $CIDR_ARGS - if [ "$IPAM_CIDRS" = "cancelled" ] ; then - echo "cancelled" >&2 - exit 0 - fi if [ -n "$REWRITE_HOSTS" ] && command_exists weavehosts ; then PATH_AND_NAME=$(docker inspect -f '{{.HostsPath}} {{.Config.Hostname}}' $CONTAINER) weavehosts $PATH_AND_NAME $ALL_CIDRS