From 9973d282932a43cf030a98472bf077a3ed97dad2 Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Thu, 26 Oct 2017 15:26:54 -0400 Subject: [PATCH] Revert couchdb changes --- physical/couchdb/couchdb.go | 29 ++----------------- .../configuration/storage/couchdb.html.md | 5 ---- .../guides/upgrading/upgrade-to-0.9.0.html.md | 24 --------------- website/source/layouts/guides.erb | 3 -- 4 files changed, 2 insertions(+), 59 deletions(-) delete mode 100644 website/source/guides/upgrading/upgrade-to-0.9.0.html.md diff --git a/physical/couchdb/couchdb.go b/physical/couchdb/couchdb.go index 6fb7ab5645..e7f945f118 100644 --- a/physical/couchdb/couchdb.go +++ b/physical/couchdb/couchdb.go @@ -22,7 +22,6 @@ import ( // CouchDBBackend allows the management of couchdb users type CouchDBBackend struct { logger log.Logger - prefix string client *couchDBClient permitPool *physical.PermitPool } @@ -159,12 +158,6 @@ func buildCouchDBBackend(conf map[string]string, logger log.Logger) (*CouchDBBac username = conf["username"] } - prefix := "$" - prefixedStr, ok := conf["prefixed"] - if ok { - prefix = prefixedStr - } - password := os.Getenv("COUCHDB_PASSWORD") if password == "" { password = conf["password"] @@ -190,7 +183,6 @@ func buildCouchDBBackend(conf map[string]string, logger log.Logger) (*CouchDBBac password: password, Client: cleanhttp.DefaultPooledClient(), }, - prefix: prefix, logger: logger, permitPool: physical.NewPermitPool(maxParInt), }, nil @@ -235,10 +227,6 @@ func (m *CouchDBBackend) Delete(key string) error { func (m *CouchDBBackend) List(prefix string) ([]string, error) { defer metrics.MeasureSince([]string{"couchdb", "list"}, time.Now()) - if m.prefix != "" { - prefix = m.prefix + prefix - } - m.permitPool.Acquire() defer m.permitPool.Release() @@ -287,10 +275,6 @@ func NewTransactionalCouchDBBackend(conf map[string]string, logger log.Logger) ( func (m *CouchDBBackend) GetInternal(key string) (*physical.Entry, error) { defer metrics.MeasureSince([]string{"couchdb", "get"}, time.Now()) - if m.prefix != "" { - key = m.prefix + key - } - return m.client.get(key) } @@ -298,17 +282,12 @@ func (m *CouchDBBackend) GetInternal(key string) (*physical.Entry, error) { func (m *CouchDBBackend) PutInternal(entry *physical.Entry) error { defer metrics.MeasureSince([]string{"couchdb", "put"}, time.Now()) - key := entry.Key - if m.prefix != "" { - key = m.prefix + entry.Key - } - - revision, _ := m.client.rev(url.PathEscape(key)) + revision, _ := m.client.rev(url.PathEscape(entry.Key)) return m.client.put(couchDBEntry{ Entry: entry, Rev: revision, - ID: url.PathEscape(key), + ID: url.PathEscape(entry.Key), }) } @@ -316,10 +295,6 @@ func (m *CouchDBBackend) PutInternal(entry *physical.Entry) error { func (m *CouchDBBackend) DeleteInternal(key string) error { defer metrics.MeasureSince([]string{"couchdb", "delete"}, time.Now()) - if m.prefix != "" { - key = m.prefix + key - } - revision, _ := m.client.rev(url.PathEscape(key)) deleted := true return m.client.put(couchDBEntry{ diff --git a/website/source/docs/configuration/storage/couchdb.html.md b/website/source/docs/configuration/storage/couchdb.html.md index 50cc90cc59..5df23e5dab 100644 --- a/website/source/docs/configuration/storage/couchdb.html.md +++ b/website/source/docs/configuration/storage/couchdb.html.md @@ -30,11 +30,6 @@ storage "couchdb" { ## `couchdb` Parameters -- `prefix` `(string: "$")` – Specifies a prefix to use for each value written - to CouchDB. If turned off (by setting to `""`, Vault may run into error - conditions if values are written that begin with an underscore, since it is a - reserved prefix in CouchDB. - - `endpoint` `(string: "")` – Specifies your CouchDB endpoint. This can also be provided via the environment variable `COUCHDB_ENDPOINT`. diff --git a/website/source/guides/upgrading/upgrade-to-0.9.0.html.md b/website/source/guides/upgrading/upgrade-to-0.9.0.html.md deleted file mode 100644 index 33a7106582..0000000000 --- a/website/source/guides/upgrading/upgrade-to-0.9.0.html.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -layout: "guides" -page_title: "Upgrading to Vault 0.9.0 - Guides" -sidebar_current: "guides-upgrading-to-0.9.0" -description: |- - This page contains the list of deprecations and important or breaking changes - for Vault 0.9.0. Please read it carefully. ---- - -# Overview - -This page contains the list of deprecations and important or breaking changes -for Vault 0.9.0 compared to the most recent release. Please read it carefully. - -## CouchDB Storage Changes - -Vault may write values to storage that start with an underscore (`_`) -character. This is a reserved character in CouchDB, which can cause breakage. -As a result, this backend now stores each value prefixed with a `$` character. - -If you are upgrading from existing CouchDB usage, you can turn off this -behavior by setting the `"prefixed"` configuration value to `"false"`. -Alternately, if you need to handle underscores at the start of keys, you can -rewrite your existing keys to start with a `$` character. diff --git a/website/source/layouts/guides.erb b/website/source/layouts/guides.erb index c1f712d1fe..e95bb84f67 100644 --- a/website/source/layouts/guides.erb +++ b/website/source/layouts/guides.erb @@ -53,9 +53,6 @@ > Upgrade to 0.8.0 - > - Upgrade to 0.9.0 -