From 280651da9c08ed86471514eb8994100627660c18 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Tue, 16 May 2017 10:45:17 +0000 Subject: [PATCH] Create constant for 'weave' network name and move inside if-statement for weavemesh --- plugin/plugin.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/plugin/plugin.go b/plugin/plugin.go index 91fb39d6..9021ebcf 100644 --- a/plugin/plugin.go +++ b/plugin/plugin.go @@ -18,6 +18,7 @@ import ( const ( pluginV2Name = "net-plugin" + defaultNetwork = "weave" MulticastOption = netplugin.MulticastOption ) @@ -53,11 +54,11 @@ func run(dockerClient *docker.Client, weave *weaveapi.Client, address, meshAddre } defer os.Remove(meshAddress) defer meshListener.Close() - } - if !isPluginV2 { - Log.Println("Creating default 'weave' network") - options := map[string]interface{}{MulticastOption: "true"} - dockerClient.EnsureNetwork("weave", pluginNameFromAddress(meshAddress), defaultSubnet, options) + if !isPluginV2 { + Log.Printf("Creating default %q network", defaultNetwork) + options := map[string]interface{}{MulticastOption: "true"} + dockerClient.EnsureNetwork(defaultNetwork, pluginNameFromAddress(meshAddress), defaultSubnet, options) + } } ready()