Skip to content
Permalink
Browse files

Appends binDir to CNI_PATH so that invoke.DelegateAdd/Del can find CN…

…I plugins in alternate paths
  • Loading branch information...
dougbtv authored and s1061123 committed Sep 17, 2019
1 parent 83556f4 commit 32afefbb3462fc1389309f0c88cbad6aea3e0879
Showing with 7 additions and 0 deletions.
  1. +7 −0 multus/multus.go
@@ -238,7 +238,10 @@ func delegateAdd(exec invoke.Exec, ifName string, delegate *types.DelegateNetCon
return nil, logging.Errorf("Multus: error in invoke Conflist add - %q: %v", delegate.ConfList.Name, err)
}
} else {
origpath := os.Getenv("CNI_PATH")
os.Setenv("CNI_PATH", origpath+":"+binDir)
result, err = invoke.DelegateAdd(context.Background(), delegate.Conf.Type, delegate.Bytes, exec)
os.Setenv("CNI_PATH", origpath)
if err != nil {
return nil, logging.Errorf("Multus: error in invoke Delegate add - %q: %v", delegate.Conf.Type, err)
}
@@ -282,9 +285,13 @@ func delegateDel(exec invoke.Exec, ifName string, delegateConf *types.DelegateNe
return logging.Errorf("Multus: error in invoke Conflist Del - %q: %v", delegateConf.ConfList.Name, err)
}
} else {
origpath := os.Getenv("CNI_PATH")
os.Setenv("CNI_PATH", origpath+":"+binDir)
if err = invoke.DelegateDel(context.Background(), delegateConf.Conf.Type, delegateConf.Bytes, exec); err != nil {
os.Setenv("CNI_PATH", origpath)
return logging.Errorf("Multus: error in invoke Delegate del - %q: %v", delegateConf.Conf.Type, err)
}
os.Setenv("CNI_PATH", origpath)
}

return err

0 comments on commit 32afefb

Please sign in to comment.
You can’t perform that action at this time.