mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 11:00:25 +00:00
cleanup: remove unused MissingPassphrase error type
Storing a passphrase is now done while the volume is created. There is no need to (re)generate a passphrase when it can not be found. Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
parent
9b6c2117f3
commit
dc81e001cf
@ -67,11 +67,6 @@ type EncryptionKMS interface {
|
|||||||
GetID() string
|
GetID() string
|
||||||
}
|
}
|
||||||
|
|
||||||
// MissingPassphrase is an error instructing to generate new passphrase.
|
|
||||||
type MissingPassphrase struct {
|
|
||||||
error
|
|
||||||
}
|
|
||||||
|
|
||||||
// SecretsKMS is default KMS implementation that means no KMS is in use.
|
// SecretsKMS is default KMS implementation that means no KMS is in use.
|
||||||
type SecretsKMS struct {
|
type SecretsKMS struct {
|
||||||
passphrase string
|
passphrase string
|
||||||
|
@ -331,9 +331,7 @@ func (vc *vaultConnection) GetID() string {
|
|||||||
// data.data.passphrase structure.
|
// data.data.passphrase structure.
|
||||||
func (kms *VaultKMS) GetPassphrase(key string) (string, error) {
|
func (kms *VaultKMS) GetPassphrase(key string) (string, error) {
|
||||||
s, err := kms.secrets.GetSecret(filepath.Join(kms.vaultPassphrasePath, key), kms.keyContext)
|
s, err := kms.secrets.GetSecret(filepath.Join(kms.vaultPassphrasePath, key), kms.keyContext)
|
||||||
if errors.Is(err, loss.ErrInvalidSecretId) {
|
if err != nil {
|
||||||
return "", MissingPassphrase{err}
|
|
||||||
} else if err != nil {
|
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/hashicorp/vault/api"
|
"github.com/hashicorp/vault/api"
|
||||||
loss "github.com/libopenstorage/secrets"
|
|
||||||
apierrs "k8s.io/apimachinery/pkg/api/errors"
|
apierrs "k8s.io/apimachinery/pkg/api/errors"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
)
|
)
|
||||||
@ -351,9 +350,7 @@ func (kms *VaultTokensKMS) initCertificates(config map[string]interface{}) error
|
|||||||
// data.data.passphrase structure.
|
// data.data.passphrase structure.
|
||||||
func (kms *VaultTokensKMS) GetPassphrase(key string) (string, error) {
|
func (kms *VaultTokensKMS) GetPassphrase(key string) (string, error) {
|
||||||
s, err := kms.secrets.GetSecret(key, kms.keyContext)
|
s, err := kms.secrets.GetSecret(key, kms.keyContext)
|
||||||
if errors.Is(err, loss.ErrInvalidSecretId) {
|
if err != nil {
|
||||||
return "", MissingPassphrase{err}
|
|
||||||
} else if err != nil {
|
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user