mirror of
https://github.com/k8snetworkplumbingwg/multus-cni.git
synced 2025-09-23 02:17:50 +00:00
Appends binDir to CNI_PATH so that invoke.DelegateAdd/Del can find CNI plugins in alternate paths
This commit is contained in:
committed by
Tomofumi Hayashi
parent
83556f49bd
commit
32afefbb34
@@ -238,7 +238,10 @@ func delegateAdd(exec invoke.Exec, ifName string, delegate *types.DelegateNetCon
|
||||
return nil, logging.Errorf("Multus: error in invoke Conflist add - %q: %v", delegate.ConfList.Name, err)
|
||||
}
|
||||
} else {
|
||||
origpath := os.Getenv("CNI_PATH")
|
||||
os.Setenv("CNI_PATH", origpath+":"+binDir)
|
||||
result, err = invoke.DelegateAdd(context.Background(), delegate.Conf.Type, delegate.Bytes, exec)
|
||||
os.Setenv("CNI_PATH", origpath)
|
||||
if err != nil {
|
||||
return nil, logging.Errorf("Multus: error in invoke Delegate add - %q: %v", delegate.Conf.Type, err)
|
||||
}
|
||||
@@ -282,9 +285,13 @@ func delegateDel(exec invoke.Exec, ifName string, delegateConf *types.DelegateNe
|
||||
return logging.Errorf("Multus: error in invoke Conflist Del - %q: %v", delegateConf.ConfList.Name, err)
|
||||
}
|
||||
} else {
|
||||
origpath := os.Getenv("CNI_PATH")
|
||||
os.Setenv("CNI_PATH", origpath+":"+binDir)
|
||||
if err = invoke.DelegateDel(context.Background(), delegateConf.Conf.Type, delegateConf.Bytes, exec); err != nil {
|
||||
os.Setenv("CNI_PATH", origpath)
|
||||
return logging.Errorf("Multus: error in invoke Delegate del - %q: %v", delegateConf.Conf.Type, err)
|
||||
}
|
||||
os.Setenv("CNI_PATH", origpath)
|
||||
}
|
||||
|
||||
return err
|
||||
|
Reference in New Issue
Block a user