Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions npm/ipsm/ipsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -616,22 +616,22 @@ func (ipsMgr *IpsetManager) DestroyNpmIpsets() error {
operationFlag: util.IpsetFlushFlag,
set: ipsetName,
}
_, flushError := ipsMgr.run(flushEntry)
_, err := ipsMgr.run(flushEntry)
if err != nil {
metrics.SendErrorLogAndMetric(util.IpsmID, "{DestroyNpmIpsets} Error: failed to flush ipset %s", ipsetName)
}
}

for _, ipsetName := range ipsetLists {
deleteEntry := &ipsEntry{
operationFlag: util.IpsetDestroyFlag,
set: ipsetName,
}
_, destroyError := ipsMgr.run(deleteEntry)

if flushError != nil {
metrics.SendErrorLogAndMetric(util.IpsmID, "{DestroyNpmIpsets} Error: failed to flush ipset %s", ipsetName)
}
if destroyError != nil {
_, err := ipsMgr.run(deleteEntry)
if err != nil {
destroyFailureCount++
metrics.SendErrorLogAndMetric(util.IpsmID, "{DestroyNpmIpsets} Error: failed to destroy ipset %s", ipsetName)
}
if flushError == nil || destroyError == nil {
} else {
metrics.RemoveAllEntriesFromIPSet(ipsetName)
}
}
Expand Down
2 changes: 1 addition & 1 deletion npm/ipsm/ipsm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -530,8 +530,8 @@ func TestDestroyNpmIpsets(t *testing.T) {
{Cmd: []string{"ipset", "-N", "-exist", util.GetHashedName(testSet2Name), "nethash"}},
{Cmd: []string{"ipset", "list"}, Stdout: ipsetListStdout},
{Cmd: []string{"ipset", "-F", "-exist", testSet1Name}},
{Cmd: []string{"ipset", "-X", "-exist", testSet1Name}},
{Cmd: []string{"ipset", "-F", "-exist", testSet2Name}},
{Cmd: []string{"ipset", "-X", "-exist", testSet1Name}},
{Cmd: []string{"ipset", "-X", "-exist", testSet2Name}},
}

Expand Down