Move warning on plugin active into Go code

This commit is contained in:
Bryan Boreham committed 2016-06-02 17:19:51 +01:00
1 parent 1d91c1a23b
commit cbf4a0facd
2 files changed
+14 -6

No files matched your search

+12
View File
@@ -47,6 +47,18 @@ func removePluginNetwork(args []string) error {
}
err = d.RemoveNetwork(networkName)
if _, ok := err.(*docker.NoSuchNetwork); !ok && err != nil {
if info, err2 := d.NetworkInfo(networkName); err2 == nil {
if len(info.Containers) > 0 {
containers := ""
for container := range info.Containers {
containers += fmt.Sprintf(" %.12s ", container)
}
return fmt.Errorf(`WARNING: the following containers are still attached to network %q:
%s
Docker operations involving those containers may pause or fail
while Weave is not running`, networkName, containers)
}
}
return fmt.Errorf("unable to remove network: %s", err)
}
return nil