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

@ -19,7 +19,6 @@ import (
"errors"
"fmt"
"net"
"os"
"runtime"
"github.com/j-keck/arping"
@ -227,9 +226,7 @@ func cmdAdd(args *skel.CmdArgs) error {
// Invoke ipam del if err to avoid ip leak
defer func() {
if err != nil {
os.Setenv("CNI_COMMAND", "DEL")
ipam.ExecDel(n.IPAM.Type, args.StdinData)
os.Setenv("CNI_COMMAND", "ADD")
}
}()