Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1841 from weaveworks/1840-weave-stop-plugin-compl…
Browse files Browse the repository at this point in the history
…aint

don't complain in `weave stop` when plugin is not enabled

Fixes #1840.
  • Loading branch information
rade committed Dec 31, 2015
2 parents a9d212c + d11b6e8 commit 24a2e43
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions weave
Original file line number Diff line number Diff line change
Expand Up @@ -1700,12 +1700,14 @@ launch_plugin() {
$PLUGIN_IMAGE "$@")
}

plugin_enabled() {
[ -z $WEAVE_NO_PLUGIN ] && check_docker_server_api_version 1.21
}

remove_plugin_network() {
if [ -z $WEAVE_NO_PLUGIN ] && check_docker_server_api_version 1.21 ; then
docker run --rm --net=host \
-v /var/run/docker.sock:/var/run/docker.sock \
$PLUGIN_IMAGE --remove-network
fi
docker run --rm --net=host \
-v /var/run/docker.sock:/var/run/docker.sock \
$PLUGIN_IMAGE --remove-network
}

stop_plugin() {
Expand Down Expand Up @@ -1850,7 +1852,7 @@ EOF
COMMON_ARGS=$(common_launch_args "$@")
launch_router "$@"
launch_proxy $COMMON_ARGS
[ -z $WEAVE_NO_PLUGIN ] && check_docker_server_api_version 1.21 && launch_plugin $COMMON_ARGS
plugin_enabled && launch_plugin $COMMON_ARGS
;;
launch-router)
deprecation_warnings "$@"
Expand Down Expand Up @@ -2128,7 +2130,7 @@ EOF
;;
stop)
[ $# -eq 0 ] || usage
stop_plugin
plugin_enabled && stop_plugin
stop_router
stop_proxy
;;
Expand All @@ -2146,7 +2148,9 @@ EOF
;;
reset)
[ $# -eq 0 ] || usage
remove_plugin_network || echo "WARNING: docker may hang in this state; re-launch weave and remove attached containers before shutting down" >&2
if plugin_enabled ; then
remove_plugin_network || echo "WARNING: docker may hang in this state; re-launch weave and remove attached containers before shutting down" >&2
fi
warn_if_stopping_proxy_in_env
call_weave DELETE /peer >/dev/null 2>&1 || true
for NAME in $PLUGIN_CONTAINER_NAME $CONTAINER_NAME $PROXY_CONTAINER_NAME ; do
Expand Down

0 comments on commit 24a2e43

Please sign in to comment.