From dce5b6176cfbc57d3da31ef817ad9153a31d64d0 Mon Sep 17 00:00:00 2001 From: Brent Baude Date: Tue, 28 Jan 2020 16:13:57 -0600 Subject: 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 --- pkg/network/files.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pkg') diff --git a/pkg/network/files.go b/pkg/network/files.go index 92cadcf0c..116189c43 100644 --- a/pkg/network/files.go +++ b/pkg/network/files.go @@ -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 -- cgit v1.2.3-54-g00ecf