mirror of
https://github.com/status-im/consul.git
synced 2025-01-09 21:35:52 +00:00
try to infer command partition from node partition (#10981)
This commit is contained in:
parent
a2e6a15e93
commit
ced8329d80
@ -235,7 +235,7 @@ func (s *HTTPHandlers) CatalogNodes(resp http.ResponseWriter, req *http.Request)
|
|||||||
// Setup the request
|
// Setup the request
|
||||||
args := structs.DCSpecificRequest{}
|
args := structs.DCSpecificRequest{}
|
||||||
s.parseSource(req, &args.Source)
|
s.parseSource(req, &args.Source)
|
||||||
if err := parseEntMetaPartition(req, &args.EnterpriseMeta); err != nil {
|
if err := s.parseEntMetaPartition(req, &args.EnterpriseMeta); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
args.NodeMetaFilters = s.parseMetaFilter(req)
|
args.NodeMetaFilters = s.parseMetaFilter(req)
|
||||||
|
@ -82,7 +82,7 @@ func (s *HTTPHandlers) CoordinateNodes(resp http.ResponseWriter, req *http.Reque
|
|||||||
if done := s.parse(resp, req, &args.Datacenter, &args.QueryOptions); done {
|
if done := s.parse(resp, req, &args.Datacenter, &args.QueryOptions); done {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
if err := parseEntMetaPartition(req, &args.EnterpriseMeta); err != nil {
|
if err := s.parseEntMetaPartition(req, &args.EnterpriseMeta); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ func (s *HTTPHandlers) CoordinateNode(resp http.ResponseWriter, req *http.Reques
|
|||||||
if done := s.parse(resp, req, &args.Datacenter, &args.QueryOptions); done {
|
if done := s.parse(resp, req, &args.Datacenter, &args.QueryOptions); done {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
if err := parseEntMetaPartition(req, &args.EnterpriseMeta); err != nil {
|
if err := s.parseEntMetaPartition(req, &args.EnterpriseMeta); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ func (s *HTTPHandlers) parseEntMeta(req *http.Request, entMeta *structs.Enterpri
|
|||||||
return BadRequestError{Reason: "Invalid query parameter: \"ns\" - Namespaces are a Consul Enterprise feature"}
|
return BadRequestError{Reason: "Invalid query parameter: \"ns\" - Namespaces are a Consul Enterprise feature"}
|
||||||
}
|
}
|
||||||
|
|
||||||
return parseEntMetaPartition(req, entMeta)
|
return s.parseEntMetaPartition(req, entMeta)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *HTTPHandlers) validateEnterpriseIntentionNamespace(logName, ns string, _ bool) error {
|
func (s *HTTPHandlers) validateEnterpriseIntentionNamespace(logName, ns string, _ bool) error {
|
||||||
@ -75,7 +75,7 @@ func (s *HTTPHandlers) uiTemplateDataTransform(data map[string]interface{}) erro
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseEntMetaPartition(req *http.Request, meta *structs.EnterpriseMeta) error {
|
func (s *HTTPHandlers) parseEntMetaPartition(req *http.Request, meta *structs.EnterpriseMeta) error {
|
||||||
if headerAP := req.Header.Get("X-Consul-Partition"); headerAP != "" {
|
if headerAP := req.Header.Get("X-Consul-Partition"); headerAP != "" {
|
||||||
return BadRequestError{Reason: "Invalid header: \"X-Consul-Partition\" - Partitions are a Consul Enterprise feature"}
|
return BadRequestError{Reason: "Invalid header: \"X-Consul-Partition\" - Partitions are a Consul Enterprise feature"}
|
||||||
}
|
}
|
||||||
|
@ -618,7 +618,7 @@ func (s *HTTPHandlers) UIMetricsProxy(resp http.ResponseWriter, req *http.Reques
|
|||||||
s.clearTokenFromHeaders(req)
|
s.clearTokenFromHeaders(req)
|
||||||
|
|
||||||
var entMeta structs.EnterpriseMeta
|
var entMeta structs.EnterpriseMeta
|
||||||
if err := parseEntMetaPartition(req, &entMeta); err != nil {
|
if err := s.parseEntMetaPartition(req, &entMeta); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
authz, err := s.agent.delegate.ResolveTokenAndDefaultMeta(token, &entMeta, nil)
|
authz, err := s.agent.delegate.ResolveTokenAndDefaultMeta(token, &entMeta, nil)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user