From 8c917eeb1735bc846388b31cd7e97ac83e13fd94 Mon Sep 17 00:00:00 2001 From: Marc CARRE Date: Mon, 6 Mar 2017 10:24:11 +0000 Subject: [PATCH] weave --local status now reports plugin. Prints the following when running: ``` Service: plugin DriverName: weave ``` See also: - https://weaveworks.slack.com/archives/net/p1488563299009870 - https://weaveworks.slack.com/archives/net/p1488539841009756 --- weave | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/weave b/weave index 623141ce..aaf830a6 100755 --- a/weave +++ b/weave @@ -341,6 +341,7 @@ CONTAINER_NAME=${WEAVE_CONTAINER_NAME:-weave} BASE_PLUGIN_IMAGE=$DOCKERHUB_USER/plugin PLUGIN_IMAGE=$BASE_PLUGIN_IMAGE:$IMAGE_VERSION PLUGIN_CONTAINER_NAME=weaveplugin +PLUGIN_V2_NAME="$DOCKERHUB_USER/pluginv2" CNI_PLUGIN_NAME="weave-plugin-$IMAGE_VERSION" CNI_PLUGIN_DIR=${WEAVE_CNI_PLUGIN_DIR:-$HOST_ROOT/opt/cni/bin} # Note VOLUMES_CONTAINER which is for weavewait should change when you upgrade Weave @@ -1211,6 +1212,10 @@ check_running() { fi } +is_docker_plugin_enabled() { + [ "$(docker plugin inspect -f '{{ .Enabled }}' "$1" 2>/dev/null)" = "true" ] +} + # Execute $@ only if the weave container is running when_weave_running() { ! check_running $CONTAINER_NAME 2>/dev/null || "$@" @@ -2082,7 +2087,7 @@ EOF echo " Service: proxy" echo " Address: $PROXY_ADDRS" fi - if [ -z "$SUB_STATUS" ] && check_running $PLUGIN_CONTAINER_NAME 2>/dev/null ; then + if [ -z "$SUB_STATUS" ] && ( is_docker_plugin_enabled "$PLUGIN_V2_NAME" || check_running $PLUGIN_CONTAINER_NAME 2>/dev/null ) ; then echo echo " Service: plugin" echo " DriverName: weave"