summaryrefslogtreecommitdiff
path: root/pkg/trust/registries.go
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2022-08-24 20:28:14 +0200
committerMiloslav Trmač <mitr@redhat.com>2022-08-25 01:52:59 +0200
commit2f6c145e86027da7ecf352331db70f5e688701b6 (patch)
tree6c68327aac711c4eb478102fd547093c975945b2 /pkg/trust/registries.go
parentb15afce551a521b6224cf0a0c5a29beb89556e91 (diff)
downloadpodman-2f6c145e86027da7ecf352331db70f5e688701b6.tar.gz
podman-2f6c145e86027da7ecf352331db70f5e688701b6.tar.bz2
podman-2f6c145e86027da7ecf352331db70f5e688701b6.zip
Use the full descriptionsOfPolicyRequirements for the default scope
... instead of taking a shortcut, e.g. not listing any keys if they are required. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Diffstat (limited to 'pkg/trust/registries.go')
-rw-r--r--pkg/trust/registries.go27
1 files changed, 15 insertions, 12 deletions
diff --git a/pkg/trust/registries.go b/pkg/trust/registries.go
index e179b61ac..0adc38232 100644
--- a/pkg/trust/registries.go
+++ b/pkg/trust/registries.go
@@ -102,21 +102,24 @@ func loadAndMergeConfig(dirPath string) (*registryConfiguration, error) {
}
// registriesDConfigurationForScope returns registries.d configuration for the provided scope.
+// scope can be "" to return only the global default configuration entry.
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(scope, "/") {
- val, exists := registryConfigs.Docker[searchScope]
- if exists {
- return &val
+ if searchScope != "" {
+ if !strings.Contains(searchScope, "/") {
+ val, exists := registryConfigs.Docker[searchScope]
+ if exists {
+ return &val
+ }
}
- if strings.Contains(searchScope, "/") {
- searchScope = searchScope[:strings.LastIndex(searchScope, "/")]
+ for range strings.Split(scope, "/") {
+ val, exists := registryConfigs.Docker[searchScope]
+ if exists {
+ return &val
+ }
+ if strings.Contains(searchScope, "/") {
+ searchScope = searchScope[:strings.LastIndex(searchScope, "/")]
+ }
}
}
return registryConfigs.DefaultDocker