Make it more clear that we failed to find an IPAM plugin.
Check for a missing plugin name and issue a more helpful error.
if os.Getenv("CNI_COMMAND") != "ADD" {
return nil, fmt.Errorf("CNI_COMMAND is not ADD")
}
+ if plugin == "" {
+ return nil, fmt.Errorf(`Name of IPAM plugin is missing. Specify a "type" field in the "ipam" section`)
+ }
pluginPath := Find(plugin)
if pluginPath == "" {
- return nil, fmt.Errorf("could not find %q plugin", plugin)
+ return nil, fmt.Errorf("could not find %q IPAM plugin", plugin)
}
stdout := &bytes.Buffer{}