Allow _all for WAN as a no-op.

This commit is contained in:
James Phillips 2017-09-05 13:40:19 -07:00
parent 316715c565
commit aecf890054
No known key found for this signature in database
GPG Key ID: 77183E682AC5FC11
1 changed files with 11 additions and 4 deletions

View File

@ -157,10 +157,17 @@ func (s *HTTPServer) AgentMembers(resp http.ResponseWriter, req *http.Request) (
}
segment := req.URL.Query().Get("segment")
if wan && segment != "" {
resp.WriteHeader(http.StatusBadRequest)
fmt.Fprint(resp, "Cannot provide a segment with wan=true")
return nil, nil
if wan {
switch segment {
case "", api.AllSegments:
// The zero value and the special "give me all members"
// key are ok, otherwise the argument doesn't apply to
// the WAN.
default:
resp.WriteHeader(http.StatusBadRequest)
fmt.Fprint(resp, "Cannot provide a segment with wan=true")
return nil, nil
}
}
var members []serf.Member