1
0
Fork 0
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:
Gustavo Carvalho 2022-03-09 13:49:17 -03:00
parent 10c3ba355d
commit 8be3cd5a72
2 changed files with 5 additions and 7 deletions

View file

@ -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
}
}

View file

@ -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
}