Skip to content

Commit

Permalink
Merge pull request #83 from fuweid/follow-fixdatarace
Browse files Browse the repository at this point in the history
init exec when create CNIConfig
  • Loading branch information
estesp authored Feb 11, 2022
2 parents d5f63dc + 2f9e685 commit e559bd8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ package cni

import (
"fmt"
"os"
"sort"
"strings"

cnilibrary "github.com/containernetworking/cni/libcni"
"github.com/containernetworking/cni/pkg/invoke"
"github.com/containernetworking/cni/pkg/version"
)

// Opt sets options for a CNI instance
Expand All @@ -41,7 +44,13 @@ func WithInterfacePrefix(prefix string) Opt {
func WithPluginDir(dirs []string) Opt {
return func(c *libcni) error {
c.pluginDirs = dirs
c.cniConfig = &cnilibrary.CNIConfig{Path: dirs}
c.cniConfig = cnilibrary.NewCNIConfig(
dirs,
&invoke.DefaultExec{
RawExec: &invoke.RawExec{Stderr: os.Stderr},
PluginDecoder: version.PluginDecoder{},
},
)
return nil
}
}
Expand Down

0 comments on commit e559bd8

Please sign in to comment.