From 67b19ac065ca8cb2eed945c1e99dc2287b867ed3 Mon Sep 17 00:00:00 2001 From: James Phillips Date: Tue, 5 Sep 2017 13:40:19 -0700 Subject: [PATCH] Allow _all for WAN as a no-op. --- agent/agent_endpoint.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/agent/agent_endpoint.go b/agent/agent_endpoint.go index 0fbf65c522..7c2276452b 100644 --- a/agent/agent_endpoint.go +++ b/agent/agent_endpoint.go @@ -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