Skip to content

Commit b1078c1

Browse files
committed
fix lease compare in txn
Signed-off-by: Petr Bodunov <[email protected]>
1 parent 438ed96 commit b1078c1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

etcdctl/ctlv3/command/txn_command.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424

2525
"github.com/spf13/cobra"
2626

27-
pb "go.etcd.io/etcd/api/v3/etcdserverpb"
2827
clientv3 "go.etcd.io/etcd/client/v3"
2928
"go.etcd.io/etcd/pkg/v3/cobrautl"
3029
)
@@ -222,7 +221,9 @@ func ParseCompare(line string) (*clientv3.Cmp, error) {
222221
case "val", "value":
223222
cmp = clientv3.Compare(clientv3.Value(key), op, val)
224223
case "lease":
225-
cmp = clientv3.Compare(clientv3.Cmp{Target: pb.Compare_LEASE}, op, val)
224+
if v, err = strconv.ParseInt(val, 16, 64); err == nil {
225+
cmp = clientv3.Compare(clientv3.LeaseValue(key), op, v)
226+
}
226227
default:
227228
return nil, fmt.Errorf("malformed comparison: %s (unknown target %s)", line, target)
228229
}

0 commit comments

Comments
 (0)