Skip to content

Commit

Permalink
fix flow for plugin check
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Zappa <[email protected]>
  • Loading branch information
MikeZappa87 committed Apr 7, 2024
1 parent 2efd342 commit ec41865
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,16 +316,15 @@ func loadFromConfDir(c *libcni, max int) error {
}

func checkPluginExists(c *libcni, confList *cnilibrary.NetworkConfigList) error {
for _, dir := range c.pluginDirs {
for _, plug := range confList.Plugins {
plugin := plug.Network.Type

if fileExistsInDir(dir, plugin) {
return nil
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)
}
}
}
return ErrCNIPluginNotFound
return nil
}

// FileExistsInDir checks if a file exists in a specific directory
Expand Down

0 comments on commit ec41865

Please sign in to comment.