Extra checks on return value from IPAM plugin

This commit is contained in:
Bryan Boreham authored and Marc Carré committed 2017-03-21 11:39:36 +00:00
1 parent c711826996
commit 56155d0819
1 file changed
+3
+3
View File
@@ -54,6 +54,9 @@ func (c *CNIPlugin) getIP(ipamType string, args *skel.CmdArgs) (newResult *curre
if err != nil {
return nil, err
}
if result == nil {
return nil, fmt.Errorf("Received no usable result from IPAM plugin")
}
newResult, err = current.NewResultFromResult(result)
// Check if ipam returned no results without error
if err == nil && len(newResult.IPs) == 0 {