Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions cni/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,6 @@ func (plugin *netPlugin) Add(args *cniSkel.CmdArgs) error {
args.ContainerID, args.Netns, args.IfName, args.Args, args.Path)

defer func() {
if result == nil {
result = &cniTypesCurr.Result{}
}

// Add Interfaces to result.
if result == nil {
result = &cniTypesCurr.Result{}
Expand All @@ -169,13 +165,17 @@ func (plugin *netPlugin) Add(args *cniSkel.CmdArgs) error {
addSnatInterface(nwCfg, result)

// Convert result to the requested CNI version.
res, err := result.GetAsVersion(nwCfg.CNIVersion)
if err != nil {
err = plugin.Error(err)
res, vererr := result.GetAsVersion(nwCfg.CNIVersion)
if vererr != nil {
log.Printf("GetAsVersion failed with error %v", vererr)
plugin.Error(vererr)
}

if err == nil && res != nil {
// Output the result to stdout.
res.Print()
}

// Output the result to stdout.
res.Print()
log.Printf("[cni-net] ADD command completed with result:%+v err:%v.", result, err)
}()

Expand Down