Allow `consul lock` to create cross-DC sessions

Signed-off-by: Johannes Löthberg <johannes.loethberg@elokon.com>
pull/21208/head
Johannes Löthberg 6 months ago
parent 22a4f96b9d
commit 42aa4ccac8
No known key found for this signature in database
GPG Key ID: FEBC5EC99474C681

@ -355,9 +355,11 @@ func (l *Lock) createSession() (string, error) {
se := l.opts.SessionOpts
if se == nil {
se = &SessionEntry{
Name: l.opts.SessionName,
TTL: l.opts.SessionTTL,
LockDelay: l.opts.LockDelay,
Name: l.opts.SessionName,
TTL: l.opts.SessionTTL,
LockDelay: l.opts.LockDelay,
Node: "",
NodeChecks: []string{},
}
}
w := WriteOptions{Namespace: l.opts.Namespace}

@ -102,7 +102,7 @@ func (s *Session) Create(se *SessionEntry, q *WriteOptions) (string, *WriteMeta,
if len(se.Checks) > 0 {
body["Checks"] = se.Checks
}
if len(se.NodeChecks) > 0 {
if se.NodeChecks != nil {
body["NodeChecks"] = se.NodeChecks
}
if len(se.ServiceChecks) > 0 {

Loading…
Cancel
Save