CLI: Tune plugin version for auth/secret mounts (#17277)

* Add -plugin-version flag to vault auth/secrets tune
* CLI tests for auth/secrets tune
* CLI test for plugin register
* Plugin catalog listing bug where plugins of different type with the same name could be double counted
* Use constant for -plugin-version flag name
This commit is contained in:
Tom Proctor
2022-09-22 20:55:46 +01:00
committed by GitHub
parent 6fc6bb1bb5
commit 21d13633d7
13 changed files with 207 additions and 54 deletions

View File

@@ -32,6 +32,7 @@ type SecretsEnableCommand struct {
flagAllowedResponseHeaders []string
flagForceNoCache bool
flagPluginName string
flagPluginVersion string
flagOptions map[string]string
flagLocal bool
flagSealWrap bool
@@ -173,6 +174,13 @@ func (c *SecretsEnableCommand) Flags() *FlagSets {
"exist in Vault's plugin catalog.",
})
f.StringVar(&StringVar{
Name: flagNamePluginVersion,
Target: &c.flagPluginVersion,
Default: "",
Usage: "Select the semantic version of the plugin to enable.",
})
f.StringMapVar(&StringMapVar{
Name: "options",
Target: &c.flagOptions,
@@ -320,6 +328,10 @@ func (c *SecretsEnableCommand) Run(args []string) int {
if fl.Name == flagNameAllowedManagedKeys {
mountInput.Config.AllowedManagedKeys = c.flagAllowedManagedKeys
}
if fl.Name == flagNamePluginVersion {
mountInput.Config.PluginVersion = c.flagPluginVersion
}
})
if err := client.Sys().Mount(mountPath, mountInput); err != nil {