forked from TrueCloudLab/certificates
better error messages
Co-authored-by: Mariano Cano <mariano.cano@gmail.com>
This commit is contained in:
parent
9ec154aab0
commit
07984a968f
1 changed files with 3 additions and 3 deletions
|
@ -84,15 +84,15 @@ func New(ctx context.Context, opts apiv1.Options) (*VaultCAS, error) {
|
||||||
case "approle":
|
case "approle":
|
||||||
method, err = approle.NewApproleAuthMethod(vc.AuthMountPath, vc.AuthOptions)
|
method, err = approle.NewApproleAuthMethod(vc.AuthMountPath, vc.AuthOptions)
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("unknown auth type: %v", vc.AuthType)
|
return nil, fmt.Errorf("unknown auth type: %s, only 'kubernetes' and 'approle' currently supported", vc.AuthType)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to configure auth method: %w", err)
|
return nil, fmt.Errorf("unable to configure %s auth method: %w", vc.AuthType, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
authInfo, err := client.Auth().Login(ctx, method)
|
authInfo, err := client.Auth().Login(ctx, method)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to login to Kubernetes auth method: %w", err)
|
return nil, fmt.Errorf("unable to login to %s auth method: %w", vc.AuthType, err)
|
||||||
}
|
}
|
||||||
if authInfo == nil {
|
if authInfo == nil {
|
||||||
return nil, errors.New("no auth info was returned after login")
|
return nil, errors.New("no auth info was returned after login")
|
||||||
|
|
Loading…
Reference in a new issue