display file name of bad cni conf

if one of the cni conf files is badly formatted or cannot be loaded, we now display the error as well as the filename.

Fixes: #2909
Signed-off-by: Brent Baude <bbaude@redhat.com>
This commit is contained in:
Brent Baude
2020-01-28 16:13:57 -06:00
parent 63b1656f4c
commit dce5b6176c

View File

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