From 293cbcbf79c6b372d1a8e177282dda776bfc62fc Mon Sep 17 00:00:00 2001 From: Tamal Saha Date: Wed, 20 Feb 2019 16:08:20 -0800 Subject: [PATCH] Prepare release 0.10.0 --- glide.lock | 20 ++++----- glide.yaml | 16 +++---- vendor/github.com/evanphx/json-patch/patch.go | 43 +++++++++++++------ 3 files changed, 49 insertions(+), 30 deletions(-) diff --git a/glide.lock b/glide.lock index 93b4058b7..d9b637c70 100644 --- a/glide.lock +++ b/glide.lock @@ -1,5 +1,5 @@ -hash: 24fe3fe2920fad7b6f7aa859e55f0dfa58660dec76ecfc6f8164b88d9c5c9507 -updated: 2019-02-18T21:26:29.841117964-08:00 +hash: 8bdde23759745fab2c7f882eec059cb9f2bc0dc7f4765a3e1549438683c08ec0 +updated: 2019-02-20T16:08:03.186585354-08:00 imports: - name: cloud.google.com/go version: 0fd7230b2a7505833d5f69b75cbd6c9582401479 @@ -103,7 +103,7 @@ imports: subpackages: - log - name: github.com/evanphx/json-patch - version: afac545df32f2287a079e2dfb7ba2745a643747e + version: 72bf35d0ff611848c1dc9df0f976c81192392fa5 - name: github.com/exponent-io/jsonpath version: d6023ce2651d8eafb5c75bb0c7167536102ec9f5 - name: github.com/fatih/camelcase @@ -207,19 +207,19 @@ imports: - client/clientset/versioned/scheme - client/clientset/versioned/typed/kubedb/v1alpha1 - name: github.com/kubedb/elasticsearch - version: 1a7c239cbe568694b3aa3dfe4fe557347fb484fd + version: b565a02edb4570ab40edda5810d2e2de7ecbdfbb - name: github.com/kubedb/etcd - version: 92a9bb0164211566feefc2488b9601458fbc9079 + version: f91ff54d3663b5c8b7d53b6db476eb987ad478e4 - name: github.com/kubedb/memcached - version: 9438d67034143287fc67b7bd5d86e31ec06d96fe + version: d81d581ed68c7a9e4270c3b30b6bc28a177f5a8c - name: github.com/kubedb/mongodb - version: f4235d2f3745e02d19225f0dcdca229a3808d02b + version: 7f66413272c0d6a69ba36b1e9a732a1eb490b771 - name: github.com/kubedb/mysql - version: 40ad7a23f0ae79f82764ff900c3cd8e04bbbefa8 + version: 678b26aa9a8c90970cf5d4e9ac6e79ca60d30725 - name: github.com/kubedb/postgres - version: 148e1042add3426d6c013a63c769774cfce2de2f + version: 2f4c2f2b99eccb69a135d9482c067528ff1e3dbf - name: github.com/kubedb/redis - version: cf31c4cc69ec96aff6ed8e08c7ed9891c95dac2a + version: cdbb6ea0e7f61fbdc1bf605556654b05fcdf1396 - name: github.com/mailru/easyjson version: 2f5df55504ebc322e4d52d34df6a1f5b503bf26d subpackages: diff --git a/glide.yaml b/glide.yaml index 21e64a0c7..f6df1222a 100644 --- a/glide.yaml +++ b/glide.yaml @@ -39,21 +39,21 @@ import: - package: github.com/json-iterator/go version: 1.1.5 - package: github.com/kubedb/apimachinery - version: master + version: 0.10.0 - package: github.com/kubedb/elasticsearch - version: master + version: 0.10.0 - package: github.com/kubedb/etcd - version: master + version: 0.2.0 - package: github.com/kubedb/memcached - version: master + version: 0.3.0 - package: github.com/kubedb/mongodb - version: master + version: 0.3.0 - package: github.com/kubedb/mysql - version: master + version: 0.3.0 - package: github.com/kubedb/postgres - version: master + version: 0.10.0 - package: github.com/kubedb/redis - version: master + version: 0.3.0 - package: github.com/mitchellh/mapstructure version: v1.1.2 - package: github.com/ncw/swift diff --git a/vendor/github.com/evanphx/json-patch/patch.go b/vendor/github.com/evanphx/json-patch/patch.go index 755d8ba3b..f26b6824b 100644 --- a/vendor/github.com/evanphx/json-patch/patch.go +++ b/vendor/github.com/evanphx/json-patch/patch.go @@ -14,6 +14,8 @@ const ( eAry ) +var SupportNegativeIndices bool = true + type lazyNode struct { raw *json.RawMessage doc partialDoc @@ -204,7 +206,7 @@ func (n *lazyNode) equal(o *lazyNode) bool { } func (o operation) kind() string { - if obj, ok := o["op"]; ok { + if obj, ok := o["op"]; ok && obj != nil { var op string err := json.Unmarshal(*obj, &op) @@ -220,7 +222,7 @@ func (o operation) kind() string { } func (o operation) path() string { - if obj, ok := o["path"]; ok { + if obj, ok := o["path"]; ok && obj != nil { var op string err := json.Unmarshal(*obj, &op) @@ -236,7 +238,7 @@ func (o operation) path() string { } func (o operation) from() string { - if obj, ok := o["from"]; ok { + if obj, ok := o["from"]; ok && obj != nil { var op string err := json.Unmarshal(*obj, &op) @@ -389,13 +391,18 @@ func (d *partialArray) add(key string, val *lazyNode) error { cur := *d - if idx < 0 { - idx *= -1 + if idx >= len(ary) { + return fmt.Errorf("Unable to access invalid index: %d", idx) + } - if idx > len(ary) { + if SupportNegativeIndices { + if idx < -len(ary) { return fmt.Errorf("Unable to access invalid index: %d", idx) } - idx = len(ary) - idx + + if idx < 0 { + idx += len(ary) + } } copy(ary[0:idx], cur[0:idx]) @@ -429,7 +436,17 @@ func (d *partialArray) remove(key string) error { cur := *d if idx >= len(cur) { - return fmt.Errorf("Unable to remove invalid index: %d", idx) + return fmt.Errorf("Unable to access invalid index: %d", idx) + } + + if SupportNegativeIndices { + if idx < -len(cur) { + return fmt.Errorf("Unable to access invalid index: %d", idx) + } + + if idx < 0 { + idx += len(cur) + } } ary := make([]*lazyNode, len(cur)-1) @@ -448,7 +465,7 @@ func (p Patch) add(doc *container, op operation) error { con, key := findObject(doc, path) if con == nil { - return fmt.Errorf("jsonpatch add operation does not apply: doc is missing path: %s", path) + return fmt.Errorf("jsonpatch add operation does not apply: doc is missing path: \"%s\"", path) } return con.add(key, op.value()) @@ -460,7 +477,7 @@ func (p Patch) remove(doc *container, op operation) error { con, key := findObject(doc, path) if con == nil { - return fmt.Errorf("jsonpatch remove operation does not apply: doc is missing path: %s", path) + return fmt.Errorf("jsonpatch remove operation does not apply: doc is missing path: \"%s\"", path) } return con.remove(key) @@ -475,8 +492,8 @@ func (p Patch) replace(doc *container, op operation) error { return fmt.Errorf("jsonpatch replace operation does not apply: doc is missing path: %s", path) } - val, ok := con.get(key) - if val == nil || ok != nil { + _, ok := con.get(key) + if ok != nil { return fmt.Errorf("jsonpatch replace operation does not apply: doc is missing key: %s", path) } @@ -533,6 +550,8 @@ func (p Patch) test(doc *container, op operation) error { return nil } return fmt.Errorf("Testing value %s failed", path) + } else if op.value() == nil { + return fmt.Errorf("Testing value %s failed", path) } if val.equal(op.value()) {