summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2021-09-11 22:05:04 +0200
committerMiloslav Trmač <mitr@redhat.com>2021-12-10 18:16:17 +0100
commit1b6bf971306af753e72db9d10f7594ecd0c89785 (patch)
treeedfe4550f539638bc254bccd415e99ee69ee86a3 /pkg
parentd29a4a6d173988b83ac78355e271d0f60e5d2830 (diff)
downloadpodman-1b6bf971306af753e72db9d10f7594ecd0c89785.tar.gz
podman-1b6bf971306af753e72db9d10f7594ecd0c89785.tar.bz2
podman-1b6bf971306af753e72db9d10f7594ecd0c89785.zip
Rename normalize and a few variables
... to refer to auth file keys instead of servers and the like. Should not change behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/auth/auth.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/pkg/auth/auth.go b/pkg/auth/auth.go
index 60c40a40b..8c6436883 100644
--- a/pkg/auth/auth.go
+++ b/pkg/auth/auth.go
@@ -258,24 +258,24 @@ func authConfigsToAuthFile(authConfigs map[string]types.DockerAuthConfig) (strin
// Now use the c/image packages to store the credentials. It's battle
// tested, and we make sure to use the same code as the image backend.
sys := types.SystemContext{AuthFilePath: authFilePath}
- for server, config := range authConfigs {
- server = normalize(server)
+ for authFileKey, config := range authConfigs {
+ key := normalizeAuthFileKey(authFileKey)
// Note that we do not validate the credentials here. We assume
// that all credentials are valid. They'll be used on demand
// later.
- if err := imageAuth.SetAuthentication(&sys, server, config.Username, config.Password); err != nil {
- return "", errors.Wrapf(err, "error storing credentials in temporary auth file (server: %q, user: %q)", server, config.Username)
+ if err := imageAuth.SetAuthentication(&sys, key, config.Username, config.Password); err != nil {
+ return "", errors.Wrapf(err, "error storing credentials in temporary auth file (key: %q / %q, user: %q)", authFileKey, key, config.Username)
}
}
return authFilePath, nil
}
-// normalize takes a server and removes the leading "http[s]://" prefix as well
+// normalizeAuthFileKey takes an auth file key and removes the leading "http[s]://" prefix as well
// as removes path suffixes from docker registries.
-func normalize(server string) string {
- stripped := strings.TrimPrefix(server, "http://")
+func normalizeAuthFileKey(authFileKey string) string {
+ stripped := strings.TrimPrefix(authFileKey, "http://")
stripped = strings.TrimPrefix(stripped, "https://")
/// Normalize docker registries