mirror of
https://github.com/external-secrets/external-secrets.git
synced 2024-12-14 11:57:59 +00:00
Merge pull request #950 from external-secrets/fix/disable-path-trimming-from-hashivault
Removing Path trimming from hashicorp Vault
This commit is contained in:
commit
787129e325
2 changed files with 6 additions and 12 deletions
|
@ -279,12 +279,12 @@ func (v *client) GetAllSecrets(ctx context.Context, ref esv1beta1.ExternalSecret
|
|||
return nil, err
|
||||
}
|
||||
if ref.Name != nil {
|
||||
return v.findSecretsFromName(ctx, potentialSecrets, *ref.Name, searchPath)
|
||||
return v.findSecretsFromName(ctx, potentialSecrets, *ref.Name)
|
||||
}
|
||||
return v.findSecretsFromTags(ctx, potentialSecrets, ref.Tags, searchPath)
|
||||
return v.findSecretsFromTags(ctx, potentialSecrets, ref.Tags)
|
||||
}
|
||||
|
||||
func (v *client) findSecretsFromTags(ctx context.Context, candidates []string, tags map[string]string, removeFromName string) (map[string][]byte, error) {
|
||||
func (v *client) findSecretsFromTags(ctx context.Context, candidates []string, tags map[string]string) (map[string][]byte, error) {
|
||||
secrets := make(map[string][]byte)
|
||||
for _, name := range candidates {
|
||||
match := true
|
||||
|
@ -304,16 +304,13 @@ func (v *client) findSecretsFromTags(ctx context.Context, candidates []string, t
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if removeFromName != "" {
|
||||
name = strings.TrimPrefix(name, removeFromName)
|
||||
}
|
||||
secrets[name] = secret
|
||||
}
|
||||
}
|
||||
return secrets, nil
|
||||
}
|
||||
|
||||
func (v *client) findSecretsFromName(ctx context.Context, candidates []string, ref esv1beta1.FindName, removeFromName string) (map[string][]byte, error) {
|
||||
func (v *client) findSecretsFromName(ctx context.Context, candidates []string, ref esv1beta1.FindName) (map[string][]byte, error) {
|
||||
secrets := make(map[string][]byte)
|
||||
matcher, err := find.New(ref)
|
||||
if err != nil {
|
||||
|
@ -326,9 +323,6 @@ func (v *client) findSecretsFromName(ctx context.Context, candidates []string, r
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if removeFromName != "" {
|
||||
name = strings.TrimPrefix(name, removeFromName)
|
||||
}
|
||||
secrets[name] = secret
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1167,8 +1167,8 @@ func TestGetAllSecrets(t *testing.T) {
|
|||
want: want{
|
||||
err: nil,
|
||||
val: map[string][]byte{
|
||||
"1": path1Bytes,
|
||||
"2": path2Bytes,
|
||||
"path/1": path1Bytes,
|
||||
"path/2": path2Bytes,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue