1
0

add noop ent supported storage check (#17883)

This commit is contained in:
Chris Capurso 2022-11-10 16:46:59 -05:00 committed by GitHub
parent 8c122a3197
commit 467384d8d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 13 deletions

View File

@ -78,9 +78,8 @@ const (
// Even though there are more types than the ones below, the following consts
// are declared internally for value comparison and reusability.
storageTypeRaft = "raft"
storageTypeConsul = "consul"
disableStorageTypeCheckEnv = "VAULT_DISABLE_SUPPORTED_STORAGE_CHECK"
storageTypeRaft = "raft"
storageTypeConsul = "consul"
)
type ServerCommand struct {
@ -1413,7 +1412,13 @@ func (c *ServerCommand) Run(args []string) int {
// Apply any enterprise configuration onto the coreConfig.
adjustCoreConfigForEnt(config, &coreConfig)
if !c.flagDev && os.Getenv(disableStorageTypeCheckEnv) == "" {
if !storageSupportedForEnt(&coreConfig) {
c.UI.Warn("")
c.UI.Warn(wrapAtLength(fmt.Sprintf("WARNING: storage configured to use %q which is not supported for Vault Enterprise, must be \"raft\" or \"consul\"", coreConfig.StorageType)))
c.UI.Warn("")
}
if !c.flagDev {
inMemStorageTypes := []string{
"inmem", "inmem_ha", "inmem_transactional", "inmem_transactional_ha",
}
@ -1422,12 +1427,6 @@ func (c *ServerCommand) Run(args []string) int {
c.UI.Warn("")
c.UI.Warn(wrapAtLength(fmt.Sprintf("WARNING: storage configured to use %q which should NOT be used in production", coreConfig.StorageType)))
c.UI.Warn("")
} else {
err = checkStorageTypeForEnt(&coreConfig)
if err != nil {
c.UI.Error(fmt.Sprintf("Invalid storage type: %s", err))
return 1
}
}
}

View File

@ -7,7 +7,7 @@ import (
var (
adjustCoreConfigForEnt = adjustCoreConfigForEntNoop
checkStorageTypeForEnt = checkStorageTypeForEntNoop
storageSupportedForEnt = checkStorageTypeForEntNoop
)
func adjustCoreConfigForEntNoop(config *server.Config, coreConfig *vault.CoreConfig) {
@ -19,6 +19,6 @@ func getFIPSInfoKeyNoop() string {
return ""
}
func checkStorageTypeForEntNoop(coreConfig *vault.CoreConfig) error {
return nil
func checkStorageTypeForEntNoop(coreConfig *vault.CoreConfig) bool {
return true
}