Vendor in latest c/common

Signed-off-by: Ashley Cui <acui@redhat.com>
This commit is contained in:
Ashley Cui
2023-01-17 12:12:17 -05:00
parent cf40adb3df
commit ddf8e49891
78 changed files with 16631 additions and 2224 deletions

View File

@@ -327,6 +327,9 @@ func (n *cniNetwork) createCNIConfigListFromNetwork(network *types.Network, writ
}
cniPathName := ""
if writeToDisk {
if err := os.MkdirAll(n.cniConfigDir, 0o755); err != nil {
return nil, "", err
}
cniPathName = filepath.Join(n.cniConfigDir, network.Name+".conflist")
err = os.WriteFile(cniPathName, b, 0o644)
if err != nil {

View File

@@ -141,11 +141,15 @@ func (n *cniNetwork) DefaultNetworkName() string {
func (n *cniNetwork) loadNetworks() error {
// check the mod time of the config dir
var modTime time.Time
f, err := os.Stat(n.cniConfigDir)
if err != nil {
// ignore error if the file does not exists
if err != nil && !errors.Is(err, os.ErrNotExist) {
return err
}
modTime := f.ModTime()
if err == nil {
modTime = f.ModTime()
}
// skip loading networks if they are already loaded and
// if the config dir was not modified since the last call