csi: return an empty result list from plugins & volumes without `type`, not an error (#7471)

This commit is contained in:
Lang Martin 2020-03-24 14:28:28 -04:00 committed by GitHub
parent 2430954a9d
commit 8bd0405f33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 4 deletions

View File

@ -7,8 +7,6 @@ import (
"github.com/hashicorp/nomad/nomad/structs"
)
const errRequiresType = "Missing required parameter type"
func (s *HTTPServer) CSIVolumesRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
if req.Method != "GET" {
return nil, CodedError(405, ErrInvalidMethod)
@ -19,7 +17,7 @@ func (s *HTTPServer) CSIVolumesRequest(resp http.ResponseWriter, req *http.Reque
query := req.URL.Query()
qtype, ok := query["type"]
if !ok {
return nil, CodedError(400, errRequiresType)
return []*structs.CSIVolListStub{}, nil
}
if qtype[0] != "csi" {
return nil, nil
@ -146,7 +144,7 @@ func (s *HTTPServer) CSIPluginsRequest(resp http.ResponseWriter, req *http.Reque
query := req.URL.Query()
qtype, ok := query["type"]
if !ok {
return nil, CodedError(400, errRequiresType)
return []*structs.CSIPluginListStub{}, nil
}
if qtype[0] != "csi" {
return nil, nil