aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2022-08-24 20:27:44 +0200
committerMiloslav Trmač <mitr@redhat.com>2022-08-29 17:55:38 +0200
commit79913c7154aef38f637ddf8441b19274b15d7100 (patch)
tree25d436f9cc51305516b2ecc4075c92596666c916
parente8cd43b414352a0488b02dad3b064a23996d1ba8 (diff)
downloadpodman-79913c7154aef38f637ddf8441b19274b15d7100.tar.gz
podman-79913c7154aef38f637ddf8441b19274b15d7100.tar.bz2
podman-79913c7154aef38f637ddf8441b19274b15d7100.zip
Rename haveMatchRegistry to registriesDConfigurationForScope
Just so that we don't have a boolean-named function returning a struct. Also reorder the parameters to have the container first, and the lookup key second. Shoud not change behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
-rw-r--r--pkg/trust/registries.go18
-rw-r--r--pkg/trust/trust.go2
2 files changed, 10 insertions, 10 deletions
diff --git a/pkg/trust/registries.go b/pkg/trust/registries.go
index 23de8b1e3..e179b61ac 100644
--- a/pkg/trust/registries.go
+++ b/pkg/trust/registries.go
@@ -101,22 +101,22 @@ func loadAndMergeConfig(dirPath string) (*registryConfiguration, error) {
return &mergedConfig, nil
}
-// haveMatchRegistry returns configuration from registryConfigs that is configured for key.
-func haveMatchRegistry(key string, registryConfigs *registryConfiguration) *registryNamespace {
- searchKey := key
- if !strings.Contains(searchKey, "/") {
- val, exists := registryConfigs.Docker[searchKey]
+// registriesDConfigurationForScope returns registries.d configuration for the provided scope.
+func registriesDConfigurationForScope(registryConfigs *registryConfiguration, scope string) *registryNamespace {
+ searchScope := scope
+ if !strings.Contains(searchScope, "/") {
+ val, exists := registryConfigs.Docker[searchScope]
if exists {
return &val
}
}
- for range strings.Split(key, "/") {
- val, exists := registryConfigs.Docker[searchKey]
+ for range strings.Split(scope, "/") {
+ val, exists := registryConfigs.Docker[searchScope]
if exists {
return &val
}
- if strings.Contains(searchKey, "/") {
- searchKey = searchKey[:strings.LastIndex(searchKey, "/")]
+ if strings.Contains(searchScope, "/") {
+ searchScope = searchScope[:strings.LastIndex(searchScope, "/")]
}
}
return registryConfigs.DefaultDocker
diff --git a/pkg/trust/trust.go b/pkg/trust/trust.go
index dd4262648..a9ce99dd3 100644
--- a/pkg/trust/trust.go
+++ b/pkg/trust/trust.go
@@ -98,7 +98,7 @@ func descriptionsOfPolicyRequirements(reqs []repoContent, template Policy, regis
}
entry.GPGId = strings.Join(uids, ", ")
- registryNamespace := haveMatchRegistry(scope, registryConfigs)
+ registryNamespace := registriesDConfigurationForScope(registryConfigs, scope)
if registryNamespace != nil {
if registryNamespace.Lookaside != "" {
entry.SignatureStore = registryNamespace.Lookaside