Skip to content

Commit e559bd8

Browse files
authored
Merge pull request #83 from fuweid/follow-fixdatarace
init exec when create CNIConfig
2 parents d5f63dc + 2f9e685 commit e559bd8

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

opts.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@ package cni
1818

1919
import (
2020
"fmt"
21+
"os"
2122
"sort"
2223
"strings"
2324

2425
cnilibrary "github.com/containernetworking/cni/libcni"
26+
"github.com/containernetworking/cni/pkg/invoke"
27+
"github.com/containernetworking/cni/pkg/version"
2528
)
2629

2730
// Opt sets options for a CNI instance
@@ -41,7 +44,13 @@ func WithInterfacePrefix(prefix string) Opt {
4144
func WithPluginDir(dirs []string) Opt {
4245
return func(c *libcni) error {
4346
c.pluginDirs = dirs
44-
c.cniConfig = &cnilibrary.CNIConfig{Path: dirs}
47+
c.cniConfig = cnilibrary.NewCNIConfig(
48+
dirs,
49+
&invoke.DefaultExec{
50+
RawExec: &invoke.RawExec{Stderr: os.Stderr},
51+
PluginDecoder: version.PluginDecoder{},
52+
},
53+
)
4554
return nil
4655
}
4756
}

0 commit comments

Comments
 (0)