diff --git a/consul/session_endpoint.go b/consul/session_endpoint.go index f7e46636f4..cfe60ea570 100644 --- a/consul/session_endpoint.go +++ b/consul/session_endpoint.go @@ -31,9 +31,10 @@ func (s *Session) Apply(args *structs.SessionRequest, reply *string) error { switch args.Session.Behavior { case structs.SessionKeysRelease, structs.SessionKeysDelete: // we like it, use it - - default: + case "": args.Session.Behavior = structs.SessionKeysRelease // force default behavior + default: + return fmt.Errorf("Invalid Behavior setting '%s'", args.Session.Behavior) } // If this is a create, we must generate the Session ID. This must diff --git a/consul/state_store.go b/consul/state_store.go index 2bd0396ef4..0173cff697 100644 --- a/consul/state_store.go +++ b/consul/state_store.go @@ -1330,9 +1330,10 @@ func (s *StateStore) SessionCreate(index uint64, session *structs.Session) error switch session.Behavior { case structs.SessionKeysRelease, structs.SessionKeysDelete: // we like + case "": + session.Behavior = structs.SessionKeysRelease // force default behavior default: - // force SessionKeysRelease - session.Behavior = structs.SessionKeysRelease + return fmt.Errorf("Invalid Session Behavior setting '%s'", session.Behavior) } // Assign the create index