dont panic when from-zone cannot be normalized (#5171)
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
This commit is contained in:
parent
d6743531ad
commit
c5eb7d0460
2 changed files with 6 additions and 1 deletions
|
@ -56,7 +56,11 @@ func parseStanza(c *caddy.Controller) (*GRPC, error) {
|
||||||
if !c.Args(&g.from) {
|
if !c.Args(&g.from) {
|
||||||
return g, c.ArgErr()
|
return g, c.ArgErr()
|
||||||
}
|
}
|
||||||
g.from = plugin.Host(g.from).NormalizeExact()[0] // only the first is used.
|
normalized := plugin.Host(g.from).NormalizeExact()
|
||||||
|
if len(normalized) == 0 {
|
||||||
|
return g, fmt.Errorf("unable to normalize '%s'", g.from)
|
||||||
|
}
|
||||||
|
g.from = normalized[0] // only the first is used.
|
||||||
|
|
||||||
to := c.RemainingArgs()
|
to := c.RemainingArgs()
|
||||||
if len(to) == 0 {
|
if len(to) == 0 {
|
||||||
|
|
|
@ -30,6 +30,7 @@ func TestSetup(t *testing.T) {
|
||||||
{"grpc . 127.0.0.1 {\nblaatl\n}\n", true, "", nil, "unknown property"},
|
{"grpc . 127.0.0.1 {\nblaatl\n}\n", true, "", nil, "unknown property"},
|
||||||
{`grpc . ::1
|
{`grpc . ::1
|
||||||
grpc com ::2`, true, "", nil, "plugin"},
|
grpc com ::2`, true, "", nil, "plugin"},
|
||||||
|
{"grpc xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 127.0.0.1", true, "", nil, "unable to normalize 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'"},
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, test := range tests {
|
for i, test := range tests {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue