diff --git a/plugins/ipam/static/main.go b/plugins/ipam/static/main.go index ed75d1fe2..5179aba10 100644 --- a/plugins/ipam/static/main.go +++ b/plugins/ipam/static/main.go @@ -161,7 +161,7 @@ func LoadIPAMConfig(bytes []byte, envArgs string) (*IPAMConfig, string, error) { ip, subnet, err := net.ParseCIDR(ipstr) if err != nil { - return nil, "", err + return nil, "", fmt.Errorf("expected CIDR notation, got '%s'", ipstr) } addr := Address{ @@ -213,7 +213,8 @@ func LoadIPAMConfig(bytes []byte, envArgs string) (*IPAMConfig, string, error) { for i := range n.IPAM.Addresses { ip, addr, err := net.ParseCIDR(n.IPAM.Addresses[i].AddressStr) if err != nil { - return nil, "", err + return nil, "", fmt.Errorf( + "expected CIDR notation, got '%s'", n.IPAM.Addresses[i].AddressStr) } n.IPAM.Addresses[i].Address = *addr n.IPAM.Addresses[i].Address.IP = ip diff --git a/plugins/ipam/static/static_test.go b/plugins/ipam/static/static_test.go index 7bd2e522b..55f117b9a 100644 --- a/plugins/ipam/static/static_test.go +++ b/plugins/ipam/static/static_test.go @@ -576,7 +576,7 @@ var _ = Describe("static Operations", func() { return cmdAdd(args) }) Expect(err).Should( - MatchError(fmt.Sprintf("invalid CIDR address: %s", ipStr))) + MatchError(fmt.Sprintf("expected CIDR notation, got '%s'", ipStr))) }) }