From 46b77f699f42bdf0ad925393313c594b7b7b3cde Mon Sep 17 00:00:00 2001 From: Riyaz Faizullabhoy Date: Thu, 1 Jun 2017 18:50:32 -0700 Subject: [PATCH] add default config and cache dir, initially use for trust Signed-off-by: Riyaz Faizullabhoy --- cmd/moby/trust.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/cmd/moby/trust.go b/cmd/moby/trust.go index b093a7214..322f6e0bf 100644 --- a/cmd/moby/trust.go +++ b/cmd/moby/trust.go @@ -10,7 +10,7 @@ import ( "net" "net/http" "net/url" - "os" + "path/filepath" "strings" "time" @@ -62,14 +62,8 @@ func TrustedReference(image string) (reference.Reference, error) { return nil, err } - tmpTrustDir, err := ioutil.TempDir("", "notary") - if err != nil { - return nil, err - } - defer os.Remove(tmpTrustDir) - nRepo, err := notaryClient.NewNotaryRepository( - tmpTrustDir, + trustDirectory(), gun, server, rt, @@ -107,6 +101,10 @@ func getTrustServer(gun string) (string, error) { return "", errors.New("non-hub images not yet supported") } +func trustDirectory() string { + return filepath.Join(MobyDir, "trust") +} + type credentialStore struct { username string password string