From 49e9d56d582af181b309e161d2f6ada9db8f987c Mon Sep 17 00:00:00 2001 From: Michael Zappa Date: Sat, 6 Apr 2024 22:14:17 -0600 Subject: [PATCH] fix logic issue Signed-off-by: Michael Zappa --- opts.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/opts.go b/opts.go index e9b18d8..24f688d 100644 --- a/opts.go +++ b/opts.go @@ -316,13 +316,21 @@ func loadFromConfDir(c *libcni, max int) error { } func checkPluginExists(c *libcni, confList *cnilibrary.NetworkConfigList) error { + var err error for _, plug := range confList.Plugins { plugin := plug.Network.Type for _, dir := range c.pluginDirs { if !fileExistsInDir(dir, plugin) { - return fmt.Errorf("plugin %s not found in: %s %v", plugin, strings.Join(c.pluginDirs, ","), ErrCNIPluginNotFound) + err = fmt.Errorf("plugin '%s' not found in: %s %v", plugin, strings.Join(c.pluginDirs, ","), ErrCNIPluginNotFound) + } else { + err = nil + continue } } + + if err != nil { + return err + } } return nil }