Flush weave ipsets before destroying

ipsets can't be destroyed when there are references to them.
This takes the easy way out and flushes all weave ipsets first.

Fixes #2915
This commit is contained in:
Mike Bryant committed 2017-05-12 09:44:26 +01:00
1 parent 95ee99d652
commit 8668f6bb1e
1 file changed
+9
+9
View File
@@ -90,6 +90,15 @@ func resetIPSets(ips ipset.Interface) error {
common.Log.Debugf("Got list of ipsets: %v", sets)
// Must remove references to ipsets by other ipsets before they're destroyed
for _, s := range sets {
common.Log.Debugf("Flushing ipset '%s'", string(s))
if err := ips.Flush(s); err != nil {
common.Log.Errorf("Failed to flush ipset '%s'", string(s))
return err
}
}
for _, s := range sets {
common.Log.Debugf("Destroying ipset '%s'", string(s))
if err := ips.Destroy(s); err != nil {