mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 19:17:58 +00:00
builtin: deprecate errwrap.Wrapf() throughout (#11430)
* audit: deprecate errwrap.Wrapf() * builtin/audit/file: deprecate errwrap.Wrapf() * builtin/crediential/app-id: deprecate errwrap.Wrapf() * builtin/credential/approle: deprecate errwrap.Wrapf() * builtin/credential/aws: deprecate errwrap.Wrapf() * builtin/credentials/token: deprecate errwrap.Wrapf() * builtin/credential/github: deprecate errwrap.Wrapf() * builtin/credential/cert: deprecate errwrap.Wrapf() * builtin/logical/transit: deprecate errwrap.Wrapf() * builtin/logical/totp: deprecate errwrap.Wrapf() * builtin/logical/ssh: deprecate errwrap.Wrapf() * builtin/logical/rabbitmq: deprecate errwrap.Wrapf() * builtin/logical/postgresql: deprecate errwrap.Wrapf() * builtin/logical/pki: deprecate errwrap.Wrapf() * builtin/logical/nomad: deprecate errwrap.Wrapf() * builtin/logical/mssql: deprecate errwrap.Wrapf() * builtin/logical/database: deprecate errwrap.Wrapf() * builtin/logical/consul: deprecate errwrap.Wrapf() * builtin/logical/cassandra: deprecate errwrap.Wrapf() * builtin/logical/aws: deprecate errwrap.Wrapf()
This commit is contained in:
@@ -13,7 +13,6 @@ import (
|
||||
|
||||
"github.com/hashicorp/vault/sdk/helper/certutil"
|
||||
|
||||
"github.com/hashicorp/errwrap"
|
||||
"github.com/hashicorp/vault/sdk/framework"
|
||||
"github.com/hashicorp/vault/sdk/helper/errutil"
|
||||
"github.com/hashicorp/vault/sdk/logical"
|
||||
@@ -158,7 +157,7 @@ func (b *backend) pathCAGenerateRoot(ctx context.Context, req *logical.Request,
|
||||
|
||||
cb, err := parsedBundle.ToCertBundle()
|
||||
if err != nil {
|
||||
return nil, errwrap.Wrapf("error converting raw cert bundle to cert bundle: {{err}}", err)
|
||||
return nil, fmt.Errorf("error converting raw cert bundle to cert bundle: %w", err)
|
||||
}
|
||||
|
||||
resp := &logical.Response{
|
||||
@@ -221,7 +220,7 @@ func (b *backend) pathCAGenerateRoot(ctx context.Context, req *logical.Request,
|
||||
Value: parsedBundle.CertificateBytes,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, errwrap.Wrapf("unable to store certificate locally: {{err}}", err)
|
||||
return nil, fmt.Errorf("unable to store certificate locally: %w", err)
|
||||
}
|
||||
|
||||
// For ease of later use, also store just the certificate at a known
|
||||
@@ -314,17 +313,17 @@ func (b *backend) pathCASignIntermediate(ctx context.Context, req *logical.Reque
|
||||
}
|
||||
|
||||
if err := parsedBundle.Verify(); err != nil {
|
||||
return nil, errwrap.Wrapf("verification of parsed bundle failed: {{err}}", err)
|
||||
return nil, fmt.Errorf("verification of parsed bundle failed: %w", err)
|
||||
}
|
||||
|
||||
signingCB, err := signingBundle.ToCertBundle()
|
||||
if err != nil {
|
||||
return nil, errwrap.Wrapf("error converting raw signing bundle to cert bundle: {{err}}", err)
|
||||
return nil, fmt.Errorf("error converting raw signing bundle to cert bundle: %w", err)
|
||||
}
|
||||
|
||||
cb, err := parsedBundle.ToCertBundle()
|
||||
if err != nil {
|
||||
return nil, errwrap.Wrapf("error converting raw cert bundle to cert bundle: {{err}}", err)
|
||||
return nil, fmt.Errorf("error converting raw cert bundle to cert bundle: %w", err)
|
||||
}
|
||||
|
||||
resp := &logical.Response{
|
||||
@@ -371,7 +370,7 @@ func (b *backend) pathCASignIntermediate(ctx context.Context, req *logical.Reque
|
||||
Value: parsedBundle.CertificateBytes,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, errwrap.Wrapf("unable to store certificate locally: {{err}}", err)
|
||||
return nil, fmt.Errorf("unable to store certificate locally: %w", err)
|
||||
}
|
||||
|
||||
if parsedBundle.Certificate.MaxPathLen == 0 {
|
||||
@@ -418,7 +417,7 @@ func (b *backend) pathCASignSelfIssued(ctx context.Context, req *logical.Request
|
||||
|
||||
signingCB, err := signingBundle.ToCertBundle()
|
||||
if err != nil {
|
||||
return nil, errwrap.Wrapf("error converting raw signing bundle to cert bundle: {{err}}", err)
|
||||
return nil, fmt.Errorf("error converting raw signing bundle to cert bundle: %w", err)
|
||||
}
|
||||
|
||||
urls := &certutil.URLEntries{}
|
||||
@@ -431,7 +430,7 @@ func (b *backend) pathCASignSelfIssued(ctx context.Context, req *logical.Request
|
||||
|
||||
newCert, err := x509.CreateCertificate(rand.Reader, cert, signingBundle.Certificate, cert.PublicKey, signingBundle.PrivateKey)
|
||||
if err != nil {
|
||||
return nil, errwrap.Wrapf("error signing self-issued certificate: {{err}}", err)
|
||||
return nil, fmt.Errorf("error signing self-issued certificate: %w", err)
|
||||
}
|
||||
if len(newCert) == 0 {
|
||||
return nil, fmt.Errorf("nil cert was created when signing self-issued certificate")
|
||||
|
||||
Reference in New Issue
Block a user