[bugfix] Delete all delegates instead of breaking out during deletion loop

This commit is contained in:
dougbtv 2018-11-29 13:49:55 -05:00 committed by Kuralamudhan Ramakrishnan
parent 96217dd16e
commit 8d89700cac

View File

@ -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")
}
var errorstrings []string
for idx := lastIdx; idx >= 0; idx-- {
ifName := getIfname(delegates[idx], argIfname, idx)
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 {
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
}
@ -451,4 +458,4 @@ func main() {
},
func(args *skel.CmdArgs) error { return cmdDel(args, nil, nil) },
version.All, "meta-plugin that delegates to other CNI plugins")
}
}