From 517a2e0e0a0bdc7495af3c1b90fb78170e5c6328 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Tue, 12 Jan 2016 16:49:57 +0000 Subject: [PATCH] Fix nonzero exit code for a pre-existing plugin on launch; do this purely for the 'plugin running' case, not 'restarting' etc. --- weave | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/weave b/weave index 19f826e8..786f8999 100755 --- a/weave +++ b/weave @@ -909,22 +909,22 @@ check_not_running() { case ${RUN_STATUS%:*} in "true restarting $3") echo "$2 is restarting; you can stop it with 'weave stop-$1'." >&2 - exit 1 + return 3 ;; "true "*" $3") echo "$2 is already running; you can stop it with 'weave stop-$1'." >&2 - exit 1 + return 1 ;; "false "*" $3") docker rm $2 >/dev/null ;; true*) echo "Found another running container named '$2'. Aborting." >&2 - exit 1 + return 2 ;; false*) echo "Found another container named '$2'. Aborting." >&2 - exit 1 + return 2 ;; esac } @@ -1851,8 +1851,11 @@ EOF launch_proxy $COMMON_ARGS # Allow an existing plugin to keep running, because we run it with restart=always if ! plugin_disabled ; then - check_not_running plugin $PLUGIN_CONTAINER_NAME $BASE_PLUGIN_IMAGE - launch_plugin $COMMON_ARGS + if check_not_running plugin $PLUGIN_CONTAINER_NAME $BASE_PLUGIN_IMAGE ; then + launch_plugin $COMMON_ARGS + else + [ $? -lt 2 ] || exit 1 + fi fi ;; launch-router)