Remove some duplication between stop and reset
This commit is contained in:
1 parent
9f4030cdb6
commit
6ba2bf80b8
1 file changed
+4
-7
@@ -1327,6 +1327,9 @@ stop() {
|
|||||||
! is_plugin_v1_enabled || util_op remove-plugin-network weave || true
|
! is_plugin_v1_enabled || util_op remove-plugin-network weave || true
|
||||||
warn_if_stopping_proxy_in_env
|
warn_if_stopping_proxy_in_env
|
||||||
docker stop $CONTAINER_NAME >/dev/null 2>&1 || echo "Weave is not running." >&2
|
docker stop $CONTAINER_NAME >/dev/null 2>&1 || echo "Weave is not running." >&2
|
||||||
|
# In case user has upgraded from <v2.0 and left old containers running
|
||||||
|
docker stop $OLD_PLUGIN_CONTAINER_NAME >/dev/null 2>&1 || true
|
||||||
|
docker stop $OLD_PROXY_CONTAINER_NAME >/dev/null 2>&1 || true
|
||||||
conntrack -D -p udp --dport $PORT >/dev/null 2>&1 || true
|
conntrack -D -p udp --dport $PORT >/dev/null 2>&1 || true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1619,14 +1622,9 @@ case "$COMMAND" in
|
|||||||
stop)
|
stop)
|
||||||
[ $# -eq 0 ] || usage
|
[ $# -eq 0 ] || usage
|
||||||
stop
|
stop
|
||||||
# In case user has upgraded from <v2.0 and left old containers running
|
|
||||||
docker stop $OLD_PLUGIN_CONTAINER_NAME >/dev/null 2>&1 || true
|
|
||||||
docker stop $OLD_PROXY_CONTAINER_NAME >/dev/null 2>&1 || true
|
|
||||||
;;
|
;;
|
||||||
reset)
|
reset)
|
||||||
[ $# -eq 0 ] || [ $# -eq 1 -a "$1" = "--force" ] || usage
|
[ $# -eq 0 ] || [ $# -eq 1 -a "$1" = "--force" ] || usage
|
||||||
! is_plugin_v1_enabled || util_op remove-plugin-network weave || true
|
|
||||||
warn_if_stopping_proxy_in_env
|
|
||||||
res=0
|
res=0
|
||||||
[ "$1" = "--force" ] || check_running $CONTAINER_NAME 2>/dev/null || res=$?
|
[ "$1" = "--force" ] || check_running $CONTAINER_NAME 2>/dev/null || res=$?
|
||||||
case $res in
|
case $res in
|
||||||
@@ -1643,14 +1641,13 @@ case "$COMMAND" in
|
|||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
stop
|
||||||
for NAME in $CONTAINER_NAME $OLD_PROXY_CONTAINER_NAME $OLD_PLUGIN_CONTAINER_NAME ; do
|
for NAME in $CONTAINER_NAME $OLD_PROXY_CONTAINER_NAME $OLD_PLUGIN_CONTAINER_NAME ; do
|
||||||
docker stop $NAME >/dev/null 2>&1 || true
|
|
||||||
docker rm -f $NAME >/dev/null 2>&1 || true
|
docker rm -f $NAME >/dev/null 2>&1 || true
|
||||||
done
|
done
|
||||||
protect_against_docker_hang
|
protect_against_docker_hang
|
||||||
VOLUME_CONTAINERS=$(docker ps -qa --filter label=weavevolumes)
|
VOLUME_CONTAINERS=$(docker ps -qa --filter label=weavevolumes)
|
||||||
[ -n "$VOLUME_CONTAINERS" ] && docker rm -v $VOLUME_CONTAINERS >/dev/null 2>&1 || true
|
[ -n "$VOLUME_CONTAINERS" ] && docker rm -v $VOLUME_CONTAINERS >/dev/null 2>&1 || true
|
||||||
conntrack -D -p udp --dport $PORT >/dev/null 2>&1 || true
|
|
||||||
destroy_bridge
|
destroy_bridge
|
||||||
for LOCAL_IFNAME in $(ip link show | grep v${CONTAINER_IFNAME}pl | cut -d ' ' -f 2 | tr -d ':') ; do
|
for LOCAL_IFNAME in $(ip link show | grep v${CONTAINER_IFNAME}pl | cut -d ' ' -f 2 | tr -d ':') ; do
|
||||||
ip link del ${LOCAL_IFNAME%@*} >/dev/null 2>&1 || true
|
ip link del ${LOCAL_IFNAME%@*} >/dev/null 2>&1 || true
|
||||||
|
|||||||
Reference in new issue
Block a user