Reorder CNI config to set options before consumers

The `WithLoNetwork` and `WithConfFile` options consume the
`WithPluginDir` and `WithInterfacePrefix` settings, so they must come
first.

This fixes the issue that the provided plugin directory was not used for
the provided configuration file. This would have been more visible, but
the default `InterfacePrefix` is already "eth".

Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
v0.8
Paul "TBBle" Hampson 2020-07-20 20:29:35 +10:00
parent dc2574ceae
commit 1fedff0e4b
1 changed files with 2 additions and 2 deletions

View File

@ -28,10 +28,10 @@ func New(opt Opt) (network.Provider, error) {
cniHandle, err := cni.New(
cni.WithMinNetworkCount(2),
cni.WithConfFile(opt.ConfigPath),
cni.WithPluginDir([]string{opt.BinaryDir}),
cni.WithInterfacePrefix(("eth")),
cni.WithLoNetwork,
cni.WithInterfacePrefix(("eth")))
cni.WithConfFile(opt.ConfigPath))
if err != nil {
return nil, err
}