pkg/trust: Take the default policy path from c/common/pkg/config

This reduces the number of places default policy path is defined to two.

[NO NEW TESTS NEEDED]

Signed-off-by: Doug Rabson <dfr@rabson.org>
This commit is contained in:
Doug Rabson
2022-11-11 11:33:20 +00:00
parent fd142ef5f4
commit 6502b1faa6

View File

@ -12,6 +12,7 @@ import (
"path/filepath"
"strings"
"github.com/containers/common/pkg/config"
"github.com/containers/image/v5/types"
"github.com/sirupsen/logrus"
)
@ -53,7 +54,7 @@ type genericRepoMap map[string]json.RawMessage
// DefaultPolicyPath returns a path to the default policy of the system.
func DefaultPolicyPath(sys *types.SystemContext) string {
systemDefaultPolicyPath := "/etc/containers/policy.json"
systemDefaultPolicyPath := config.DefaultSignaturePolicyPath
if sys != nil {
if sys.SignaturePolicyPath != "" {
return sys.SignaturePolicyPath