nomad: fixing client endpoint

This commit is contained in:
Armon Dadgar 2015-07-03 17:47:55 -07:00
parent abef9ca0a1
commit 9871e84c63

View file

@ -24,19 +24,22 @@ func (c *Client) Register(args *structs.RegisterRequest, reply *structs.Register
if args.Region == "" { if args.Region == "" {
return fmt.Errorf("missing region for client registration") return fmt.Errorf("missing region for client registration")
} }
if args.Datacenter == "" { if args.Node == nil {
return fmt.Errorf("missing node for client registration")
}
if args.Node.ID == "" {
return fmt.Errorf("missing node ID for client registration")
}
if args.Node.Datacenter == "" {
return fmt.Errorf("missing datacenter for client registration") return fmt.Errorf("missing datacenter for client registration")
} }
if args.Node == "" { if args.Node.Name == "" {
return fmt.Errorf("missing node name for client registration") return fmt.Errorf("missing node name for client registration")
} }
if _, ok := args.Capabilities[structs.CoreCapability]; !ok {
return fmt.Errorf("missing core capability for client registration")
}
// Default the status if none is given // Default the status if none is given
if args.Status == "" { if args.Node.Status == "" {
args.Status = structs.StatusInit args.Node.Status = structs.NodeStatusInit
} }
// Commit this update via Raft // Commit this update via Raft