Skip to content

Commit

Permalink
Change to return 204 for OSS /v1/operator/license
Browse files Browse the repository at this point in the history
This is quite naïve but it’s working for me locally!
  • Loading branch information
backspace committed Feb 3, 2021
1 parent 4e0e33e commit 0103622
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions command/agent/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ func (s *HTTPServer) registerHandlers(enableDebug bool) {

s.mux.HandleFunc("/v1/search", s.wrap(s.SearchRequest))

s.mux.HandleFunc("/v1/operator/license", s.wrap(s.LicenseRequest))
s.mux.HandleFunc("/v1/operator/raft/", s.wrap(s.OperatorRequest))
s.mux.HandleFunc("/v1/operator/autopilot/configuration", s.wrap(s.OperatorAutopilotConfiguration))
s.mux.HandleFunc("/v1/operator/autopilot/health", s.wrap(s.OperatorServerHealth))
Expand Down
2 changes: 0 additions & 2 deletions command/agent/http_oss.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ func (s *HTTPServer) registerEnterpriseHandlers() {
s.mux.HandleFunc("/v1/quota/", s.wrap(s.entOnly))
s.mux.HandleFunc("/v1/quota", s.wrap(s.entOnly))

s.mux.HandleFunc("/v1/operator/license", s.wrap(s.entOnly))

s.mux.HandleFunc("/v1/recommendation", s.wrap(s.entOnly))
s.mux.HandleFunc("/v1/recommendations", s.wrap(s.entOnly))
s.mux.HandleFunc("/v1/recommendations/apply", s.wrap(s.entOnly))
Expand Down
11 changes: 11 additions & 0 deletions command/agent/operator_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,17 @@ func (s *HTTPServer) schedulerUpdateConfig(resp http.ResponseWriter, req *http.R
return reply, nil
}

func (s *HTTPServer) LicenseRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
switch req.Method {
case "GET":
resp.WriteHeader(http.StatusNoContent)
return "", nil
default:
return nil, CodedError(405, ErrInvalidMethod)
}

}

func (s *HTTPServer) SnapshotRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
switch req.Method {
case "GET":
Expand Down

0 comments on commit 0103622

Please sign in to comment.