Merge pull request #5008 from baude/badconf

display file name of bad cni conf
This commit is contained in:
OpenShift Merge Robot
2020-01-28 15:55:26 -08:00
committed by GitHub

View File

@ -24,7 +24,7 @@ func LoadCNIConfsFromDir(dir string) ([]*libcni.NetworkConfigList, error) {
for _, confFile := range files { for _, confFile := range files {
conf, err := libcni.ConfListFromFile(confFile) conf, err := libcni.ConfListFromFile(confFile)
if err != nil { if err != nil {
return nil, err return nil, errors.Wrapf(err, "in %s", confFile)
} }
configs = append(configs, conf) configs = append(configs, conf)
} }
@ -41,7 +41,7 @@ func GetCNIConfigPathByName(name string) (string, error) {
for _, confFile := range files { for _, confFile := range files {
conf, err := libcni.ConfListFromFile(confFile) conf, err := libcni.ConfListFromFile(confFile)
if err != nil { if err != nil {
return "", err return "", errors.Wrapf(err, "in %s", confFile)
} }
if conf.Name == name { if conf.Name == name {
return confFile, nil return confFile, nil