forked from github/multus-cni
[bugfix] Delete all delegates instead of breaking out during deletion loop
This commit is contained in:
parent
96217dd16e
commit
8d89700cac
@ -253,14 +253,21 @@ func delPlugins(exec invoke.Exec, argIfname string, delegates []*types.DelegateN
|
|||||||
return logging.Errorf("Multus: error in setting CNI_COMMAND to DEL")
|
return logging.Errorf("Multus: error in setting CNI_COMMAND to DEL")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var errorstrings []string
|
||||||
for idx := lastIdx; idx >= 0; idx-- {
|
for idx := lastIdx; idx >= 0; idx-- {
|
||||||
ifName := getIfname(delegates[idx], argIfname, idx)
|
ifName := getIfname(delegates[idx], argIfname, idx)
|
||||||
rt.IfName = ifName
|
rt.IfName = ifName
|
||||||
|
// Attempt to delete all but do not error out, instead, collect all errors.
|
||||||
if err := delegateDel(exec, ifName, delegates[idx], rt, binDir); err != nil {
|
if err := delegateDel(exec, ifName, delegates[idx], rt, binDir); err != nil {
|
||||||
return err
|
errorstrings = append(errorstrings, err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if we had any errors, and send them all back.
|
||||||
|
if len(errorstrings) > 0 {
|
||||||
|
return fmt.Errorf(strings.Join(errorstrings, " / "))
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user