diff --git a/libnetwork/internal/kvstore/kvstore.go b/libnetwork/internal/kvstore/kvstore.go index 49e2eb9dcd..38bac4c48f 100644 --- a/libnetwork/internal/kvstore/kvstore.go +++ b/libnetwork/internal/kvstore/kvstore.go @@ -20,7 +20,7 @@ const ( var ( // ErrNotSupported is thrown when the backend k/v store is not supported by libkv - ErrNotSupported = errors.New("Backend storage not supported yet, please choose another one") + ErrNotSupported = errors.New("Backend storage not supported yet, please choose one of") // ErrNotImplemented is thrown when a method is not implemented by the current backend ErrNotImplemented = errors.New("Call not implemented in current backend") // ErrNotReachable is thrown when the API cannot be reached for issuing common store operations diff --git a/libnetwork/internal/kvstore/kvstore_manage.go b/libnetwork/internal/kvstore/kvstore_manage.go index 9035f64f3c..da20ae5320 100644 --- a/libnetwork/internal/kvstore/kvstore_manage.go +++ b/libnetwork/internal/kvstore/kvstore_manage.go @@ -62,6 +62,10 @@ package libkv import ( + "fmt" + "sort" + "strings" + "github.com/docker/libkv/store" "github.com/docker/libkv/store/consul" "github.com/docker/libkv/store/etcd" @@ -78,6 +82,14 @@ var ( store.ETCD: etcd.New, store.ZK: zookeeper.New, } + supportedBackend = func() string { + keys := make([]string, 0, len(initializers)) + for k := range initializers { + keys = append(keys, string(k)) + } + sort.Strings(keys) + return strings.Join(keys, ", ") + }() ) // NewStore creates a an instance of store @@ -86,5 +98,5 @@ func NewStore(backend store.Backend, addrs []string, options *store.Config) (sto return init(addrs, options) } - return nil, store.ErrNotSupported + return nil, fmt.Errorf("%s %s", store.ErrNotSupported.Error(), supportedBackend) }