Fix wrong err return value in plugin reload status command (#9348)

* Fix wrong return value (discovered when merging to ENT)

* go.mod

* go mod vendor

* Add setup plugin reload hook

* All reloads return something now
This commit is contained in:
Scott Miller 2020-06-30 13:33:30 -05:00 committed by GitHub
parent 001ee861bd
commit ad292bec73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 15 additions and 5 deletions

View File

@ -261,7 +261,7 @@ func (c *Sys) ReloadPlugin(i *ReloadPluginInput) (string, error) {
// Get the reload id
secret, parseErr := ParseSecret(resp.Body)
if parseErr != nil {
return "", err
return "", parseErr
}
if _, ok := secret.Data["reload_id"]; ok {
return secret.Data["reload_id"].(string), nil

2
go.mod
View File

@ -84,7 +84,7 @@ require (
github.com/hashicorp/vault-plugin-secrets-kv v0.5.5
github.com/hashicorp/vault-plugin-secrets-mongodbatlas v0.1.2
github.com/hashicorp/vault-plugin-secrets-openldap v0.1.4-0.20200618161832-cae59ebde561
github.com/hashicorp/vault/api v1.0.5-0.20200630135746-8163ff047c9a
github.com/hashicorp/vault/api v1.0.5-0.20200630153159-69a37f1037b5
github.com/hashicorp/vault/sdk v0.1.14-0.20200527182800-ad90e0b39d2f
github.com/influxdata/influxdb v0.0.0-20190411212539-d24b7ba8c4c4
github.com/jcmturner/gokrb5/v8 v8.0.0

View File

@ -1932,6 +1932,9 @@ func (s standardUnsealStrategy) unseal(ctx context.Context, logger log.Logger, c
if err := c.setupAuditedHeadersConfig(ctx); err != nil {
return err
}
if err := c.setupPluginReload(); err != nil {
return err
}
} else {
c.auditBroker = NewAuditBroker(c.logger)
}

View File

@ -467,9 +467,12 @@ func testSystemBackend_PluginReload(t *testing.T, reqData map[string]interface{}
if err != nil {
t.Fatalf("err: %v", err)
}
if resp != nil {
if resp == nil {
t.Fatalf("bad: %v", resp)
}
if resp.Data["reload_id"] == nil {
t.Fatal("no reload_id in response")
}
for i := 0; i < 2; i++ {
// Ensure internal backed value is reset

View File

@ -195,3 +195,7 @@ func (c *Core) reloadBackendCommon(ctx context.Context, entry *MountEntry, isAut
return nil
}
func (c *Core) setupPluginReload() error {
return handleSetupPluginReload(c)
}

View File

@ -261,7 +261,7 @@ func (c *Sys) ReloadPlugin(i *ReloadPluginInput) (string, error) {
// Get the reload id
secret, parseErr := ParseSecret(resp.Body)
if parseErr != nil {
return "", err
return "", parseErr
}
if _, ok := secret.Data["reload_id"]; ok {
return secret.Data["reload_id"].(string), nil

2
vendor/modules.txt vendored
View File

@ -495,7 +495,7 @@ github.com/hashicorp/vault-plugin-secrets-mongodbatlas
# github.com/hashicorp/vault-plugin-secrets-openldap v0.1.4-0.20200618161832-cae59ebde561
github.com/hashicorp/vault-plugin-secrets-openldap
github.com/hashicorp/vault-plugin-secrets-openldap/client
# github.com/hashicorp/vault/api v1.0.5-0.20200630135746-8163ff047c9a => ./api
# github.com/hashicorp/vault/api v1.0.5-0.20200630153159-69a37f1037b5 => ./api
github.com/hashicorp/vault/api
# github.com/hashicorp/vault/sdk v0.1.14-0.20200527182800-ad90e0b39d2f => ./sdk
github.com/hashicorp/vault/sdk/database/dbplugin