From 38b55bd8b146dc8967f585205a414df75c99c92b Mon Sep 17 00:00:00 2001 From: vishalnayak Date: Fri, 19 Feb 2016 14:59:15 -0500 Subject: [PATCH] Don't deprecate value field yet --- builtin/logical/mysql/backend.go | 2 +- builtin/logical/mysql/backend_test.go | 10 ++++++++-- builtin/logical/mysql/path_config_connection.go | 4 +++- website/source/docs/secrets/mysql/index.html.md | 1 - 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/builtin/logical/mysql/backend.go b/builtin/logical/mysql/backend.go index a100702d4..ea719e6e8 100644 --- a/builtin/logical/mysql/backend.go +++ b/builtin/logical/mysql/backend.go @@ -74,7 +74,7 @@ func (b *backend) DB(s logical.Storage) (*sql.DB, error) { return nil, err } - conn := connConfig.ConnectionURL + conn := connConfig.ConnectionString if len(conn) == 0 { conn = connConfig.ConnectionURL } diff --git a/builtin/logical/mysql/backend_test.go b/builtin/logical/mysql/backend_test.go index 00fef7675..b302e29ca 100644 --- a/builtin/logical/mysql/backend_test.go +++ b/builtin/logical/mysql/backend_test.go @@ -14,14 +14,20 @@ import ( func TestBackend_basic(t *testing.T) { b, _ := Factory(logical.TestBackendConfig()) - d := map[string]interface{}{ + d1 := map[string]interface{}{ "connection_url": os.Getenv("MYSQL_DSN"), } + d2 := map[string]interface{}{ + "value": os.Getenv("MYSQL_DSN"), + } logicaltest.Test(t, logicaltest.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Backend: b, Steps: []logicaltest.TestStep{ - testAccStepConfig(t, d, false), + testAccStepConfig(t, d1, false), + testAccStepRole(t), + testAccStepReadCreds(t, "web"), + testAccStepConfig(t, d2, false), testAccStepRole(t), testAccStepReadCreds(t, "web"), }, diff --git a/builtin/logical/mysql/path_config_connection.go b/builtin/logical/mysql/path_config_connection.go index 7cb1c9c06..1e332a2e4 100644 --- a/builtin/logical/mysql/path_config_connection.go +++ b/builtin/logical/mysql/path_config_connection.go @@ -95,7 +95,9 @@ func (b *backend) pathConnectionWrite( } type connectionConfig struct { - ConnectionURL string `json:"connection_url"` + ConnectionURL string `json:"connection_url"` + // Deprecate "value" in coming releases + ConnectionString string `json:"value"` MaxOpenConnections int `json:"max_open_connections"` } diff --git a/website/source/docs/secrets/mysql/index.html.md b/website/source/docs/secrets/mysql/index.html.md index 35c8df7b6..b0f2fe00d 100644 --- a/website/source/docs/secrets/mysql/index.html.md +++ b/website/source/docs/secrets/mysql/index.html.md @@ -138,7 +138,6 @@ allowed to read.
  • value optionsl - DEPRECATED; use "connection_url" instead