From: Neil Wilson Date: Mon, 7 Sep 2015 15:15:23 +0000 (+0000) Subject: IPAM plugin: improve error messages X-Git-Url: https://git.halfball.org/?a=commitdiff_plain;h=b5db5d3075b5e65bfa9bcb72ffd9a39218f3b9f8;p=plugins.git IPAM plugin: improve error messages Make it more clear that we failed to find an IPAM plugin. Check for a missing plugin name and issue a more helpful error. --- diff --git a/plugin/ipam.go b/plugin/ipam.go index 93a0d5c..8690b89 100644 --- a/plugin/ipam.go +++ b/plugin/ipam.go @@ -63,10 +63,13 @@ func ExecAdd(plugin string, netconf []byte) (*Result, 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{}