don't attempt to delete the mesh network on plugin termination
It's pointless and inconsistent. Firstly, deletion will fail if there are any attached containers. Secondly, we run the plugin with restart=always, so it will get restarted and the network re-created. Removal of the network does still happen on `weave stop|reset`, if possible.
This commit is contained in:
1 parent
a83b58cd27
commit
8061ea4079
1 file changed
+6
-18
+6
-18
@@ -5,9 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
|
||||||
|
|
||||||
"github.com/docker/libnetwork/ipamapi"
|
"github.com/docker/libnetwork/ipamapi"
|
||||||
go_docker "github.com/fsouza/go-dockerclient"
|
go_docker "github.com/fsouza/go-dockerclient"
|
||||||
@@ -90,22 +88,12 @@ func main() {
|
|||||||
createNetwork(dockerClient, meshNetworkName, meshAddress)
|
createNetwork(dockerClient, meshNetworkName, meshAddress)
|
||||||
}
|
}
|
||||||
|
|
||||||
sigChan := make(chan os.Signal, 1)
|
err = <-endChan
|
||||||
signal.Notify(sigChan, os.Interrupt, os.Kill, syscall.SIGTERM)
|
if err != nil {
|
||||||
|
Log.Errorf("Error from listener: %s", err)
|
||||||
select {
|
globalListener.Close()
|
||||||
case sig := <-sigChan:
|
meshListener.Close()
|
||||||
Log.Debugf("Caught signal %s; shutting down", sig)
|
os.Exit(1)
|
||||||
if err := dockerClient.Client.RemoveNetwork(meshNetworkName); err != nil {
|
|
||||||
Log.Fatal(err)
|
|
||||||
}
|
|
||||||
case err := <-endChan:
|
|
||||||
if err != nil {
|
|
||||||
Log.Errorf("Error from listener: %s", err)
|
|
||||||
globalListener.Close()
|
|
||||||
meshListener.Close()
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user