Fix: rotate root credentials for database plugins using WAL (#8782)

* fix: rotate root credentials for database plugins using WAL

* test: adds a test for WAL rollback logic

* fix: progress on wal rollback

* docs: updates some comments

* docs: updates some comments

* test: adds additional test coverage for WAL rollback

* chore: remove unneeded log

* style: error handling, imports, signature line wraps

* fix: always close db plugin connection
This commit is contained in:
Austin Gebauer
2020-04-22 16:21:28 -07:00
committed by GitHub
parent 8f834b3e76
commit 7807d451d9
9 changed files with 611 additions and 27 deletions

View File

@@ -8,10 +8,10 @@ import (
"sync"
"time"
"github.com/hashicorp/errwrap"
metrics "github.com/armon/go-metrics"
"github.com/hashicorp/errwrap"
log "github.com/hashicorp/go-hclog"
"google.golang.org/grpc/status"
)
// ---- Tracing Middleware Domain ----
@@ -318,6 +318,15 @@ func (mw *DatabaseErrorSanitizerMiddleware) sanitize(err error) error {
if k == "" {
continue
}
// Attempt to keep the status code attached to the
// error without changing the actual error message
s, ok := status.FromError(err)
if ok {
err = status.Error(s.Code(), strings.Replace(s.Message(), k, v.(string), -1))
continue
}
err = errors.New(strings.Replace(err.Error(), k, v.(string), -1))
}
}