Merge remote-tracking branch 'upstream/1.4'

This commit is contained in:
Matthias Radestock committed 2015-12-22 13:50:10 +00:00
commit 716f50c4e4
1 file changed
+19 -22
+19 -22
View File
@@ -906,29 +906,27 @@ container_weave_addrs() {
# functions for interacting with containers # functions for interacting with containers
###################################################################### ######################################################################
# Check that a container named $1 with image $2 is not running # Check that a container for component $1 named $2 with image $3 is not running
check_not_running() { check_not_running() {
case $(docker inspect --format='{{.State.Running}} {{.Config.Image}}' $1 2>/dev/null) in RUN_STATUS=$(docker inspect --format='{{.State.Running}} {{.State.Status}} {{.Config.Image}}' $2 2>/dev/null) || true
"true $2") case ${RUN_STATUS%:*} in
echo "$1 is already running." >&2 "true restarting $3")
echo "$2 is restarting; you can stop it with 'weave stop-$1'." >&2
exit 1 exit 1
;; ;;
"true $2:"*) "true "*" $3")
echo "$1 is already running." >&2 echo "$2 is already running; you can stop it with 'weave stop-$1'." >&2
exit 1 exit 1
;; ;;
"false $2") "false "*" $3")
docker rm $1 >/dev/null docker rm $2 >/dev/null
;;
"false $2:"*)
docker rm $1 >/dev/null
;; ;;
true*) true*)
echo "Found another running container named '$1'. Aborting." >&2 echo "Found another running container named '$2'. Aborting." >&2
exit 1 exit 1
;; ;;
false*) false*)
echo "Found another container named '$1'. Aborting." >&2 echo "Found another container named '$2'. Aborting." >&2
exit 1 exit 1
;; ;;
esac esac
@@ -1822,6 +1820,7 @@ case "$COMMAND" in
[ $# -eq 0 ] || usage [ $# -eq 0 ] || usage
ask_version $CONTAINER_NAME $IMAGE || true ask_version $CONTAINER_NAME $IMAGE || true
ask_version $PROXY_CONTAINER_NAME $EXEC_IMAGE --entrypoint=/home/weave/weaveproxy || true ask_version $PROXY_CONTAINER_NAME $EXEC_IMAGE --entrypoint=/home/weave/weaveproxy || true
ask_version $PLUGIN_CONTAINER_NAME $PLUGIN_IMAGE || true
;; ;;
# intentionally undocumented since it assumes knowledge of weave # intentionally undocumented since it assumes knowledge of weave
# internals # internals
@@ -1843,19 +1842,17 @@ EOF
;; ;;
launch) launch)
deprecation_warnings "$@" deprecation_warnings "$@"
check_not_running $CONTAINER_NAME $BASE_IMAGE check_not_running router $CONTAINER_NAME $BASE_IMAGE
check_not_running $PROXY_CONTAINER_NAME $BASE_EXEC_IMAGE check_not_running proxy $PROXY_CONTAINER_NAME $BASE_EXEC_IMAGE
check_not_running plugin $PLUGIN_CONTAINER_NAME $BASE_PLUGIN_IMAGE
COMMON_ARGS=$(common_launch_args "$@") COMMON_ARGS=$(common_launch_args "$@")
launch_router "$@" launch_router "$@"
launch_proxy $COMMON_ARGS launch_proxy $COMMON_ARGS
if [ -z $WEAVE_NO_PLUGIN ] && check_docker_server_api_version 1.21 ; then [ -z $WEAVE_NO_PLUGIN ] && check_docker_server_api_version 1.21 && launch_plugin $COMMON_ARGS
check_not_running $PLUGIN_CONTAINER_NAME $BASE_PLUGIN_IMAGE
launch_plugin $COMMON_ARGS
fi
;; ;;
launch-router) launch-router)
deprecation_warnings "$@" deprecation_warnings "$@"
check_not_running $CONTAINER_NAME $BASE_IMAGE check_not_running router $CONTAINER_NAME $BASE_IMAGE
launch_router "$@" launch_router "$@"
echo $ROUTER_CONTAINER echo $ROUTER_CONTAINER
;; ;;
@@ -1869,12 +1866,12 @@ EOF
;; ;;
launch-proxy) launch-proxy)
deprecation_warnings "$@" deprecation_warnings "$@"
check_not_running $PROXY_CONTAINER_NAME $BASE_EXEC_IMAGE check_not_running proxy $PROXY_CONTAINER_NAME $BASE_EXEC_IMAGE
launch_proxy "$@" launch_proxy "$@"
echo $PROXY_CONTAINER echo $PROXY_CONTAINER
;; ;;
launch-plugin) launch-plugin)
check_not_running $PLUGIN_CONTAINER_NAME $BASE_PLUGIN_IMAGE check_not_running plugin $PLUGIN_CONTAINER_NAME $BASE_PLUGIN_IMAGE
launch_plugin "$@" launch_plugin "$@"
echo $PLUGIN_CONTAINER echo $PLUGIN_CONTAINER
;; ;;