nomad: RPC layer should check for missing region
This commit is contained in:
parent
f16fc93d85
commit
1f8d11eb49
|
@ -21,9 +21,6 @@ func (c *Client) Register(args *structs.RegisterRequest, reply *structs.GenericR
|
|||
defer metrics.MeasureSince([]string{"nomad", "client", "register"}, time.Now())
|
||||
|
||||
// Validate the arguments
|
||||
if args.Region == "" {
|
||||
return fmt.Errorf("missing region for client registration")
|
||||
}
|
||||
if args.Node == nil {
|
||||
return fmt.Errorf("missing node for client registration")
|
||||
}
|
||||
|
|
|
@ -168,8 +168,12 @@ func (s *Server) handleNomadConn(conn net.Conn) {
|
|||
// forward is used to forward to a remote region or to forward to the local leader
|
||||
// Returns a bool of if forwarding was performed, as well as any error
|
||||
func (s *Server) forward(method string, info structs.RPCInfo, args interface{}, reply interface{}) (bool, error) {
|
||||
// Handle region forwarding
|
||||
region := info.RequestRegion()
|
||||
if region == "" {
|
||||
return true, fmt.Errorf("missing target RPC")
|
||||
}
|
||||
|
||||
// Handle region forwarding
|
||||
if region != s.config.Region {
|
||||
err := s.forwardRegion(region, method, args, reply)
|
||||
return true, err
|
||||
|
|
Loading…
Reference in New Issue