Have ipam.ExecDel set CNI_COMMAND to DEL

This commit is contained in:
Michael Cambria
2019-05-03 17:17:58 -04:00
parent a03e6b505e
commit 02ccf1ef9b
7 changed files with 34 additions and 9 deletions

View File

@ -140,6 +140,14 @@ func cmdAdd(args *skel.CmdArgs) error {
if err != nil {
return err
}
// Invoke ipam del if err to avoid ip leak
defer func() {
if err != nil {
ipam.ExecDel(n.IPAM.Type, args.StdinData)
}
}()
// Convert whatever the IPAM result was into the current Result type
result, err := current.NewResultFromResult(r)
if err != nil {