Mark database-specific secrets engines Pending Removal (#17038)
* plugins: Mark standalone database plugins Pending Removal * Add changelog
This commit is contained in:
parent
a79dc6c1e9
commit
991c574660
|
@ -0,0 +1,3 @@
|
||||||
|
```release-note:change
|
||||||
|
secrets: All database-specific (standalone DB) secrets engines are now marked `Pending Removal`.
|
||||||
|
```
|
|
@ -2,6 +2,7 @@ package command
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
@ -242,14 +243,23 @@ func TestSecretsEnableCommand_Run(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, b := range backends {
|
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)
|
ui, cmd := testSecretsEnableCommand(t)
|
||||||
cmd.client = client
|
cmd.client = client
|
||||||
|
|
||||||
code := cmd.Run([]string{
|
actualResult := cmd.Run([]string{
|
||||||
b,
|
b,
|
||||||
})
|
})
|
||||||
if exp := 0; code != exp {
|
if actualResult != expectedResult {
|
||||||
t.Errorf("type %s, expected %d to be %d - %s", b, code, exp, ui.OutputWriter.String()+ui.ErrorWriter.String())
|
t.Errorf("type: %s - got: %d, expected: %d - %s", b, actualResult, expectedResult, ui.OutputWriter.String()+ui.ErrorWriter.String())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -141,7 +141,7 @@ func newRegistry() *registry {
|
||||||
"azure": {Factory: logicalAzure.Factory},
|
"azure": {Factory: logicalAzure.Factory},
|
||||||
"cassandra": {
|
"cassandra": {
|
||||||
Factory: logicalCass.Factory,
|
Factory: logicalCass.Factory,
|
||||||
DeprecationStatus: consts.Deprecated,
|
DeprecationStatus: consts.PendingRemoval,
|
||||||
},
|
},
|
||||||
"consul": {Factory: logicalConsul.Factory},
|
"consul": {Factory: logicalConsul.Factory},
|
||||||
"gcp": {Factory: logicalGcp.Factory},
|
"gcp": {Factory: logicalGcp.Factory},
|
||||||
|
@ -150,23 +150,23 @@ func newRegistry() *registry {
|
||||||
"kv": {Factory: logicalKv.Factory},
|
"kv": {Factory: logicalKv.Factory},
|
||||||
"mongodb": {
|
"mongodb": {
|
||||||
Factory: logicalMongo.Factory,
|
Factory: logicalMongo.Factory,
|
||||||
DeprecationStatus: consts.Deprecated,
|
DeprecationStatus: consts.PendingRemoval,
|
||||||
},
|
},
|
||||||
"mongodbatlas": {Factory: logicalMongoAtlas.Factory},
|
"mongodbatlas": {Factory: logicalMongoAtlas.Factory},
|
||||||
"mssql": {
|
"mssql": {
|
||||||
Factory: logicalMssql.Factory,
|
Factory: logicalMssql.Factory,
|
||||||
DeprecationStatus: consts.Deprecated,
|
DeprecationStatus: consts.PendingRemoval,
|
||||||
},
|
},
|
||||||
"mysql": {
|
"mysql": {
|
||||||
Factory: logicalMysql.Factory,
|
Factory: logicalMysql.Factory,
|
||||||
DeprecationStatus: consts.Deprecated,
|
DeprecationStatus: consts.PendingRemoval,
|
||||||
},
|
},
|
||||||
"nomad": {Factory: logicalNomad.Factory},
|
"nomad": {Factory: logicalNomad.Factory},
|
||||||
"openldap": {Factory: logicalOpenLDAP.Factory},
|
"openldap": {Factory: logicalOpenLDAP.Factory},
|
||||||
"pki": {Factory: logicalPki.Factory},
|
"pki": {Factory: logicalPki.Factory},
|
||||||
"postgresql": {
|
"postgresql": {
|
||||||
Factory: logicalPostgres.Factory,
|
Factory: logicalPostgres.Factory,
|
||||||
DeprecationStatus: consts.Deprecated,
|
DeprecationStatus: consts.PendingRemoval,
|
||||||
},
|
},
|
||||||
"rabbitmq": {Factory: logicalRabbit.Factory},
|
"rabbitmq": {Factory: logicalRabbit.Factory},
|
||||||
"ssh": {Factory: logicalSsh.Factory},
|
"ssh": {Factory: logicalSsh.Factory},
|
||||||
|
|
|
@ -180,8 +180,8 @@ func Test_RegistryStatus(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "deprecated builtin lookup",
|
name: "deprecated builtin lookup",
|
||||||
builtin: "mongodb",
|
builtin: "pcf",
|
||||||
pluginType: consts.PluginTypeSecrets,
|
pluginType: consts.PluginTypeCredential,
|
||||||
want: consts.Deprecated,
|
want: consts.Deprecated,
|
||||||
wantOk: true,
|
wantOk: true,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue