mirror of
https://github.com/status-im/consul.git
synced 2025-01-11 14:24:39 +00:00
Set empty Behavior setting into SessionKeysRelease and flag error for unrecognized values
This commit is contained in:
parent
6ef03a806c
commit
d7933ae747
@ -31,9 +31,10 @@ func (s *Session) Apply(args *structs.SessionRequest, reply *string) error {
|
|||||||
switch args.Session.Behavior {
|
switch args.Session.Behavior {
|
||||||
case structs.SessionKeysRelease, structs.SessionKeysDelete:
|
case structs.SessionKeysRelease, structs.SessionKeysDelete:
|
||||||
// we like it, use it
|
// we like it, use it
|
||||||
|
case "":
|
||||||
default:
|
|
||||||
args.Session.Behavior = structs.SessionKeysRelease // force default behavior
|
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
|
// If this is a create, we must generate the Session ID. This must
|
||||||
|
@ -1330,9 +1330,10 @@ func (s *StateStore) SessionCreate(index uint64, session *structs.Session) error
|
|||||||
switch session.Behavior {
|
switch session.Behavior {
|
||||||
case structs.SessionKeysRelease, structs.SessionKeysDelete:
|
case structs.SessionKeysRelease, structs.SessionKeysDelete:
|
||||||
// we like
|
// we like
|
||||||
|
case "":
|
||||||
|
session.Behavior = structs.SessionKeysRelease // force default behavior
|
||||||
default:
|
default:
|
||||||
// force SessionKeysRelease
|
return fmt.Errorf("Invalid Session Behavior setting '%s'", session.Behavior)
|
||||||
session.Behavior = structs.SessionKeysRelease
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assign the create index
|
// Assign the create index
|
||||||
|
Loading…
x
Reference in New Issue
Block a user