diff --git a/libnetwork/datastore/datastore.go b/libnetwork/datastore/datastore.go index 12908533d8..ce35e0f508 100644 --- a/libnetwork/datastore/datastore.go +++ b/libnetwork/datastore/datastore.go @@ -2,7 +2,6 @@ package datastore import ( "fmt" - "reflect" "strings" "sync" "time" @@ -132,17 +131,6 @@ func Key(key ...string) string { return str + "/" } -// ParseKey provides convenient method to unpack the key to complement the Key function -func ParseKey(key string) ([]string, error) { - chain := strings.Split(strings.Trim(key, "/"), "/") - - // The key must at least be equal to the rootChain in order to be considered as valid - if len(chain) <= len(rootChain) || !reflect.DeepEqual(chain[0:len(rootChain)], rootChain) { - return nil, types.BadRequestErrorf("invalid Key : %s", key) - } - return chain[len(rootChain):], nil -} - // newClient used to connect to KV Store func newClient(kv string, addr string, config *store.Config) (*Store, error) { if config == nil { diff --git a/libnetwork/datastore/datastore_test.go b/libnetwork/datastore/datastore_test.go index 24585e9f1c..cc5a72634c 100644 --- a/libnetwork/datastore/datastore_test.go +++ b/libnetwork/datastore/datastore_test.go @@ -2,7 +2,6 @@ package datastore import ( "encoding/json" - "reflect" "testing" "github.com/docker/docker/libnetwork/options" @@ -24,17 +23,6 @@ func TestKey(t *testing.T) { } } -func TestParseKey(t *testing.T) { - keySlice, err := ParseKey("/docker/network/v1.0/hello/world/") - if err != nil { - t.Fatal(err) - } - eKey := []string{"hello", "world"} - if len(keySlice) < 2 || !reflect.DeepEqual(eKey, keySlice) { - t.Fatalf("unexpected unkey : %s", keySlice) - } -} - func TestInvalidDataStore(t *testing.T) { _, err := New(ScopeCfg{ Client: ScopeClientCfg{