mirror of
https://github.com/external-secrets/external-secrets.git
synced 2024-12-14 11:57:59 +00:00
Moving duplication validation logic to utils method
Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
This commit is contained in:
parent
10c3ba355d
commit
8be3cd5a72
2 changed files with 5 additions and 7 deletions
|
@ -276,9 +276,6 @@ func (v *client) findSecretsFromTags(ctx context.Context, candidates []string, t
|
|||
if removeFromName != "" {
|
||||
name = strings.TrimPrefix(name, removeFromName)
|
||||
}
|
||||
if _, exists := secrets[name]; exists {
|
||||
return nil, fmt.Errorf(errDuplicateSecret, name)
|
||||
}
|
||||
secrets[name] = secret
|
||||
}
|
||||
}
|
||||
|
@ -300,9 +297,6 @@ func (v *client) findSecretsFromName(ctx context.Context, candidates []string, r
|
|||
if removeFromName != "" {
|
||||
name = strings.TrimPrefix(name, removeFromName)
|
||||
}
|
||||
if _, exists := secrets[name]; exists {
|
||||
return nil, fmt.Errorf(errDuplicateSecret, name)
|
||||
}
|
||||
secrets[name] = secret
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,11 @@ func ConvertKeys(strategy esv1beta1.ExternalSecretConversionStrategy, in map[str
|
|||
newName[rk] = string(rv)
|
||||
}
|
||||
}
|
||||
out[strings.Join(newName, "")] = v
|
||||
key := strings.Join(newName, "")
|
||||
if _, exists := out[key]; exists {
|
||||
return nil, fmt.Errorf("secret name collision during conversion: %s", key)
|
||||
}
|
||||
out[key] = v
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue