mirror of https://github.com/containers/podman.git
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:
parent
63b1656f4c
commit
dce5b6176c
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue