mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-04 20:47:50 +00:00
Backport of Check if plugin version matches running version into release/1.12.x (#17264)
* backport of commit 0b34b73c47
* Change usages of RunningSha to RunningSha256
Some PRs got crossed and somehow these were missed in the
build checks for #17182.
Co-authored-by: Christopher Swenson <christopher.swenson@hashicorp.com>
This commit is contained in:
committed by
GitHub
parent
8ca24cb2a2
commit
6c74e5c491
@@ -14,6 +14,7 @@ import (
|
||||
"github.com/hashicorp/vault/sdk/database/helper/dbutil"
|
||||
"github.com/hashicorp/vault/sdk/helper/dbtxn"
|
||||
"github.com/hashicorp/vault/sdk/helper/template"
|
||||
"github.com/hashicorp/vault/sdk/logical"
|
||||
_ "github.com/jackc/pgx/v4/stdlib"
|
||||
)
|
||||
|
||||
@@ -32,7 +33,8 @@ ALTER ROLE "{{username}}" WITH PASSWORD '{{password}}';
|
||||
)
|
||||
|
||||
var (
|
||||
_ dbplugin.Database = &PostgreSQL{}
|
||||
_ dbplugin.Database = (*PostgreSQL)(nil)
|
||||
_ logical.PluginVersioner = (*PostgreSQL)(nil)
|
||||
|
||||
// postgresEndStatement is basically the word "END" but
|
||||
// surrounded by a word boundary to differentiate it from
|
||||
@@ -46,6 +48,9 @@ var (
|
||||
// singleQuotedPhrases finds substrings like 'hello'
|
||||
// and pulls them out with the quotes included.
|
||||
singleQuotedPhrases = regexp.MustCompile(`('.*?')`)
|
||||
|
||||
// ReportedVersion is used to report a specific version to Vault.
|
||||
ReportedVersion = ""
|
||||
)
|
||||
|
||||
func New() (interface{}, error) {
|
||||
@@ -469,6 +474,10 @@ func (p *PostgreSQL) secretValues() map[string]string {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *PostgreSQL) PluginVersion() logical.PluginVersion {
|
||||
return logical.PluginVersion{Version: ReportedVersion}
|
||||
}
|
||||
|
||||
// containsMultilineStatement is a best effort to determine whether
|
||||
// a particular statement is multiline, and therefore should not be
|
||||
// split upon semicolons. If it's unsure, it defaults to false.
|
||||
|
||||
Reference in New Issue
Block a user