From 495d0b659a0a78855183135c5d427ce79ac43552 Mon Sep 17 00:00:00 2001
From: Matthew Mosesohn <mmosesohn@mirantis.com>
Date: Wed, 14 Dec 2016 16:41:13 +0300
Subject: [PATCH] Fix weave restart after docker daemon restart

---
 roles/network_plugin/weave/templates/weave.service.j2      | 3 ++-
 roles/network_plugin/weave/templates/weaveproxy.service.j2 | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/roles/network_plugin/weave/templates/weave.service.j2 b/roles/network_plugin/weave/templates/weave.service.j2
index e901c34e7..2df0cb989 100644
--- a/roles/network_plugin/weave/templates/weave.service.j2
+++ b/roles/network_plugin/weave/templates/weave.service.j2
@@ -6,11 +6,12 @@ After=docker.service docker.socket
 
 [Service]
 EnvironmentFile=-/etc/weave.env
+ExecStartPre=-/usr/bin/docker rm -f weave
 ExecStartPre={{ bin_dir }}/weave launch-router \
             $WEAVE_SUBNET \
             $WEAVE_PEERS
 ExecStart=/usr/bin/docker attach weave
-ExecStop={{ bin_dir }}/weave stop-router
+ExecStop={{ bin_dir }}/weave stop
 
 [Install]
 WantedBy=multi-user.target
diff --git a/roles/network_plugin/weave/templates/weaveproxy.service.j2 b/roles/network_plugin/weave/templates/weaveproxy.service.j2
index 29197296f..9b2a522ba 100644
--- a/roles/network_plugin/weave/templates/weaveproxy.service.j2
+++ b/roles/network_plugin/weave/templates/weaveproxy.service.j2
@@ -7,6 +7,7 @@ After=docker.service docker.socket
 [Service]
 EnvironmentFile=-/etc/weave.%H.env
 EnvironmentFile=-/etc/weave.env
+ExecStartPre=-/usr/bin/docker rm -f weaveproxy
 ExecStartPre={{ bin_dir }}/weave launch-proxy $WEAVEPROXY_ARGS
 ExecStart=/usr/bin/docker attach weaveproxy
 Restart=on-failure
-- 
GitLab