forked from github/multus-cni
Make conflistDel() behave like conflistAdd()
conflistAdd() finds binaries differently than conflistDel(). Make the two call find binaries the same way. Fixes #179 Signed-off-by: Michael Cambria <mcambria@redhat.com>
This commit is contained in:
parent
da20d1d875
commit
7f389e7e7c
@ -139,11 +139,12 @@ func conflistAdd(rt *libcni.RuntimeConf, rawnetconflist []byte, binDir string) (
|
|||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func conflistDel(rt *libcni.RuntimeConf, rawnetconflist []byte, binDir string) error {
|
func conflistDel(rt *libcni.RuntimeConf, rawnetconflist []byte, binDir string, exec invoke.Exec) error {
|
||||||
logging.Debugf("conflistDel: %v, %s, %s", rt, string(rawnetconflist), binDir)
|
logging.Debugf("conflistDel: %v, %s, %s", rt, string(rawnetconflist), binDir)
|
||||||
// In part, adapted from K8s pkg/kubelet/dockershim/network/cni/cni.go
|
// In part, adapted from K8s pkg/kubelet/dockershim/network/cni/cni.go
|
||||||
binDirs := []string{binDir}
|
binDirs := filepath.SplitList(os.Getenv("CNI_PATH"))
|
||||||
cniNet := libcni.CNIConfig{Path: binDirs}
|
binDirs = append(binDirs, binDir)
|
||||||
|
cniNet := libcni.NewCNIConfig(binDirs, exec)
|
||||||
|
|
||||||
confList, err := libcni.ConfListFromBytes(rawnetconflist)
|
confList, err := libcni.ConfListFromBytes(rawnetconflist)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -192,7 +193,7 @@ func delegateDel(exec invoke.Exec, ifName string, delegateConf *types.DelegateNe
|
|||||||
}
|
}
|
||||||
|
|
||||||
if delegateConf.ConfListPlugin != false {
|
if delegateConf.ConfListPlugin != false {
|
||||||
err := conflistDel(rt, delegateConf.Bytes, binDir)
|
err := conflistDel(rt, delegateConf.Bytes, binDir, exec)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return logging.Errorf("Multus: error in invoke Conflist Del - %q: %v", delegateConf.ConfList.Name, err)
|
return logging.Errorf("Multus: error in invoke Conflist Del - %q: %v", delegateConf.ConfList.Name, err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user