Update secrets fields
This commit is contained in:
parent
2fb6bf9882
commit
b7128f8370
|
@ -2,6 +2,7 @@ package dbs
|
|||
|
||||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/hashicorp/vault/helper/strutil"
|
||||
|
@ -41,6 +42,10 @@ func (m *MySQL) CreateUser(statements Statements, username, password, expiration
|
|||
return err
|
||||
}
|
||||
|
||||
if statements.CreationStatements == "" {
|
||||
return fmt.Errorf("Empty creation statements")
|
||||
}
|
||||
|
||||
// Start a transaction
|
||||
tx, err := db.Begin()
|
||||
if err != nil {
|
||||
|
|
|
@ -197,22 +197,22 @@ func (b *databaseBackend) pathConnectionWrite(req *logical.Request, data *framew
|
|||
b.connections[name] = db
|
||||
}
|
||||
|
||||
/*
|
||||
// Don't check the connection_url if verification is disabled
|
||||
verifyConnection := data.Get("verify_connection").(bool)
|
||||
if verifyConnection {
|
||||
// Verify the string
|
||||
db, err := sql.Open("postgres", connURL)
|
||||
if err != nil {
|
||||
return logical.ErrorResponse(fmt.Sprintf(
|
||||
"Error validating connection info: %s", err)), nil
|
||||
}
|
||||
defer db.Close()
|
||||
if err := db.Ping(); err != nil {
|
||||
return logical.ErrorResponse(fmt.Sprintf(
|
||||
"Error validating connection info: %s", err)), nil
|
||||
}
|
||||
/* TODO:
|
||||
// Don't check the connection_url if verification is disabled
|
||||
verifyConnection := data.Get("verify_connection").(bool)
|
||||
if verifyConnection {
|
||||
// Verify the string
|
||||
db, err := sql.Open("postgres", connURL)
|
||||
if err != nil {
|
||||
return logical.ErrorResponse(fmt.Sprintf(
|
||||
"Error validating connection info: %s", err)), nil
|
||||
}
|
||||
defer db.Close()
|
||||
if err := db.Ping(); err != nil {
|
||||
return logical.ErrorResponse(fmt.Sprintf(
|
||||
"Error validating connection info: %s", err)), nil
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Store it
|
||||
|
|
|
@ -11,18 +11,8 @@ const SecretCredsType = "creds"
|
|||
|
||||
func secretCreds(b *databaseBackend) *framework.Secret {
|
||||
return &framework.Secret{
|
||||
Type: SecretCredsType,
|
||||
Fields: map[string]*framework.FieldSchema{
|
||||
"username": &framework.FieldSchema{
|
||||
Type: framework.TypeString,
|
||||
Description: "Username",
|
||||
},
|
||||
|
||||
"password": &framework.FieldSchema{
|
||||
Type: framework.TypeString,
|
||||
Description: "Password",
|
||||
},
|
||||
},
|
||||
Type: SecretCredsType,
|
||||
Fields: map[string]*framework.FieldSchema{},
|
||||
|
||||
Renew: b.secretCredsRenew,
|
||||
Revoke: b.secretCredsRevoke,
|
||||
|
|
Loading…
Reference in New Issue