summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pkg/trust/policy.go11
1 files changed, 4 insertions, 7 deletions
diff --git a/pkg/trust/policy.go b/pkg/trust/policy.go
index df4f49ff1..77e02a05c 100644
--- a/pkg/trust/policy.go
+++ b/pkg/trust/policy.go
@@ -151,11 +151,15 @@ func AddPolicyEntries(policyPath string, input AddPolicyEntriesInput) error {
if len(pubkeysfile) != 0 {
return fmt.Errorf("%d public keys unexpectedly provided for trust type %v", len(pubkeysfile), input.Type)
}
+ newReposContent = append(newReposContent, RepoContent{Type: trustType})
case "signedBy":
if len(pubkeysfile) == 0 {
return errors.New("at least one public key must be defined for type 'signedBy'")
}
+ for _, filepath := range pubkeysfile {
+ newReposContent = append(newReposContent, RepoContent{Type: trustType, KeyType: "GPGKeys", KeyPath: filepath})
+ }
default:
return fmt.Errorf("unknown trust type %q", input.Type)
@@ -171,13 +175,6 @@ func AddPolicyEntries(policyPath string, input AddPolicyEntriesInput) error {
return errors.New("could not read trust policies")
}
}
- if len(pubkeysfile) != 0 {
- for _, filepath := range pubkeysfile {
- newReposContent = append(newReposContent, RepoContent{Type: trustType, KeyType: "GPGKeys", KeyPath: filepath})
- }
- } else {
- newReposContent = append(newReposContent, RepoContent{Type: trustType})
- }
if input.Scope == "default" {
policyContentStruct.Default = newReposContent
} else {