Add plugin backend reload capability (#3112)

* Add plugin reload capability on all mounts for a specific plugin type

* Comments cleanup

* Add per-mount plugin backend reload, add tests

* Fix typos

* Remove old comment

* Reuse existing storage view in reloadPluginCommon

* Correctly handle reloading auth plugin backends

* Update path to plugin/backend/reload

* Use multierrors on reloadMatchingPluginMounts, attempt to reload all mounts provided

* Use internal value as check to ensure plugin backend reload

* Remove connection state from request for plugins at the moment

* Minor cleanup

* Refactor tests
This commit is contained in:
Calvin Leung Huang
2017-08-08 00:18:59 -04:00
committed by GitHub
parent f2f0082ba5
commit 01d1c20e4c
7 changed files with 371 additions and 13 deletions

View File

@@ -9,15 +9,26 @@ import (
// it is used to test the invalidate func.
func pathInternal(b *backend) *framework.Path {
return &framework.Path{
Pattern: "internal",
Fields: map[string]*framework.FieldSchema{},
ExistenceCheck: b.pathExistenceCheck,
Pattern: "internal",
Fields: map[string]*framework.FieldSchema{
"value": &framework.FieldSchema{Type: framework.TypeString},
},
Callbacks: map[logical.Operation]framework.OperationFunc{
logical.ReadOperation: b.pathInternalRead,
logical.UpdateOperation: b.pathInternalUpdate,
logical.ReadOperation: b.pathInternalRead,
},
}
}
func (b *backend) pathInternalUpdate(
req *logical.Request, data *framework.FieldData) (*logical.Response, error) {
value := data.Get("value").(string)
b.internal = value
// Return the secret
return nil, nil
}
func (b *backend) pathInternalRead(
req *logical.Request, data *framework.FieldData) (*logical.Response, error) {
// Return the secret