1
0
Fork 0
mirror of https://github.com/external-secrets/external-secrets.git synced 2024-12-14 11:57:59 +00:00

Add more context to error handling for parsing certs in order for log format to display properly (#2428)

* Add more context to error handling for parsing certs in order for
log format to display properly

Signed-off-by: Dusan Nikolic <dusannikolic11@gmail.com>

* Create error instead of string as arg

Signed-off-by: Dusan Nikolic <dusannikolic11@gmail.com>

* fix: unit test

Signed-off-by: Moritz Johner <beller.moritz@googlemail.com>

---------

Signed-off-by: Dusan Nikolic <dusannikolic11@gmail.com>
Signed-off-by: Moritz Johner <beller.moritz@googlemail.com>
Co-authored-by: Dusan Nikolic <dusannikolic@MacBook-Pro-66.local>
Co-authored-by: Moritz Johner <beller.moritz@googlemail.com>
This commit is contained in:
DusanCar11 2023-07-02 22:49:51 +02:00 committed by GitHub
parent 759c5e40f9
commit 298f580d1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -993,7 +993,7 @@ func (v *client) newConfig() (*vault.Config, error) {
if len(v.store.CABundle) > 0 {
ok := caCertPool.AppendCertsFromPEM(v.store.CABundle)
if !ok {
return nil, errors.New(errVaultCert)
return nil, fmt.Errorf(errVaultCert, errors.New("failed to parse certificates from CertPool"))
}
}
@ -1020,7 +1020,7 @@ func (v *client) newConfig() (*vault.Config, error) {
ok := caCertPool.AppendCertsFromPEM(cert)
if !ok {
return nil, errors.New(errVaultCert)
return nil, fmt.Errorf(errVaultCert, errors.New("failed to parse certificates from CertPool"))
}
}

View file

@ -258,7 +258,7 @@ MIIFkTCCA3mgAwIBAgIUBEUg3m/WqAsWHG4Q/II3IePFfuowDQYJKoZIhvcNAQELBQAwWDELMAkGA1UE
}),
},
want: want{
err: errors.New(errVaultCert),
err: fmt.Errorf(errVaultCert, errors.New("failed to parse certificates from CertPool")),
},
},
"VaultAuthFormatError": {