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 committed 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
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.