From c38a7af05d12f371b201c29f1fb4d25af4ac005f Mon Sep 17 00:00:00 2001 From: Brian Kassouf Date: Fri, 15 Mar 2019 12:49:31 -0700 Subject: [PATCH] update kv plugin --- .../vault-plugin-secrets-kv/upgrade.go | 18 +++++++++++++++--- vendor/vendor.json | 6 +++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/vendor/github.com/hashicorp/vault-plugin-secrets-kv/upgrade.go b/vendor/github.com/hashicorp/vault-plugin-secrets-kv/upgrade.go index fecf91aba2..6f98921b81 100644 --- a/vendor/github.com/hashicorp/vault-plugin-secrets-kv/upgrade.go +++ b/vendor/github.com/hashicorp/vault-plugin-secrets-kv/upgrade.go @@ -18,6 +18,15 @@ import ( "github.com/hashicorp/vault/logical/framework" ) +func (b *versionedKVBackend) perfSecondaryCheck() bool { + replState := b.System().ReplicationState() + if (!b.System().LocalMount() && replState.HasState(consts.ReplicationPerformanceSecondary)) || + replState.HasState(consts.ReplicationPerformanceStandby) { + return true + } + return false +} + func (b *versionedKVBackend) upgradeCheck(next framework.OperationFunc) framework.OperationFunc { return func(ctx context.Context, req *logical.Request, data *framework.FieldData) (*logical.Response, error) { if atomic.LoadUint32(b.upgrading) == 1 { @@ -28,7 +37,11 @@ func (b *versionedKVBackend) upgradeCheck(next framework.OperationFunc) framewor time.Sleep(15 * time.Millisecond) if atomic.LoadUint32(b.upgrading) == 1 { - return logical.ErrorResponse("Upgrading from non-versioned to versioned data. This backend will be unavailable for a brief period and will resume service shortly."), logical.ErrInvalidRequest + if b.perfSecondaryCheck() { + return logical.ErrorResponse("Waiting for the primary to upgrade from non-versioned to versioned data. This backend will be unavailable for a brief period and will resume service when the primary is finished."), logical.ErrInvalidRequest + } else { + return logical.ErrorResponse("Upgrading from non-versioned to versioned data. This backend will be unavailable for a brief period and will resume service shortly."), logical.ErrInvalidRequest + } } } @@ -74,8 +87,7 @@ func (b *versionedKVBackend) Upgrade(ctx context.Context, s logical.Storage) err // If we are a replication secondary or performance standby, wait until the primary has finished // upgrading. - if (!b.System().LocalMount() && replState.HasState(consts.ReplicationPerformanceSecondary)) || - replState.HasState(consts.ReplicationPerformanceStandby) { + if b.perfSecondaryCheck() { b.Logger().Info("upgrade not running on performance replication secondary or performance standby") go func() { diff --git a/vendor/vendor.json b/vendor/vendor.json index 3d6328d204..cf72e1a9d7 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -1481,10 +1481,10 @@ "revisionTime": "2019-01-16T16:49:38Z" }, { - "checksumSHA1": "z4IHCgxIAMCZls4JLY08wYe2wwU=", + "checksumSHA1": "MW8Ju+DGO9JhWsRgL1bahDv2b2w=", "path": "github.com/hashicorp/vault-plugin-secrets-kv", - "revision": "e0dca442917fcb1a060f942c19d0d6d87408ae7c", - "revisionTime": "2019-03-15T18:52:46Z" + "revision": "dccffee64925e322daef806ae9df1aef002de225", + "revisionTime": "2019-03-15T19:27:09Z" }, { "checksumSHA1": "ldkAQ1CpiAaQ9sti0qIch+UyRsI=",