Mark database-specific secrets engines Pending Removal (#17038)

* plugins: Mark standalone database plugins Pending Removal
* Add changelog
This commit is contained in:
Mike Palmiotto 2022-09-07 10:45:09 -04:00 committed by GitHub
parent a79dc6c1e9
commit 991c574660
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 10 deletions

3
changelog/17038.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:change
secrets: All database-specific (standalone DB) secrets engines are now marked `Pending Removal`.
```

View File

@ -2,6 +2,7 @@ package command
import (
"io/ioutil"
"os"
"strings"
"testing"
@ -242,14 +243,23 @@ func TestSecretsEnableCommand_Run(t *testing.T) {
}
for _, b := range backends {
expectedResult := 0
status, _ := builtinplugins.Registry.DeprecationStatus(b, consts.PluginTypeSecrets)
allowDeprecated := os.Getenv(consts.VaultAllowPendingRemovalMountsEnv)
// Need to handle deprecated builtins specially
if (status == consts.PendingRemoval && allowDeprecated == "") || status == consts.Removed {
expectedResult = 2
}
ui, cmd := testSecretsEnableCommand(t)
cmd.client = client
code := cmd.Run([]string{
actualResult := cmd.Run([]string{
b,
})
if exp := 0; code != exp {
t.Errorf("type %s, expected %d to be %d - %s", b, code, exp, ui.OutputWriter.String()+ui.ErrorWriter.String())
if actualResult != expectedResult {
t.Errorf("type: %s - got: %d, expected: %d - %s", b, actualResult, expectedResult, ui.OutputWriter.String()+ui.ErrorWriter.String())
}
}
})

View File

@ -141,7 +141,7 @@ func newRegistry() *registry {
"azure": {Factory: logicalAzure.Factory},
"cassandra": {
Factory: logicalCass.Factory,
DeprecationStatus: consts.Deprecated,
DeprecationStatus: consts.PendingRemoval,
},
"consul": {Factory: logicalConsul.Factory},
"gcp": {Factory: logicalGcp.Factory},
@ -150,23 +150,23 @@ func newRegistry() *registry {
"kv": {Factory: logicalKv.Factory},
"mongodb": {
Factory: logicalMongo.Factory,
DeprecationStatus: consts.Deprecated,
DeprecationStatus: consts.PendingRemoval,
},
"mongodbatlas": {Factory: logicalMongoAtlas.Factory},
"mssql": {
Factory: logicalMssql.Factory,
DeprecationStatus: consts.Deprecated,
DeprecationStatus: consts.PendingRemoval,
},
"mysql": {
Factory: logicalMysql.Factory,
DeprecationStatus: consts.Deprecated,
DeprecationStatus: consts.PendingRemoval,
},
"nomad": {Factory: logicalNomad.Factory},
"openldap": {Factory: logicalOpenLDAP.Factory},
"pki": {Factory: logicalPki.Factory},
"postgresql": {
Factory: logicalPostgres.Factory,
DeprecationStatus: consts.Deprecated,
DeprecationStatus: consts.PendingRemoval,
},
"rabbitmq": {Factory: logicalRabbit.Factory},
"ssh": {Factory: logicalSsh.Factory},

View File

@ -180,8 +180,8 @@ func Test_RegistryStatus(t *testing.T) {
},
{
name: "deprecated builtin lookup",
builtin: "mongodb",
pluginType: consts.PluginTypeSecrets,
builtin: "pcf",
pluginType: consts.PluginTypeCredential,
want: consts.Deprecated,
wantOk: true,
},