trust: use a tempdir and remove after build

Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
This commit is contained in:
Riyaz Faizullabhoy 2017-05-26 14:29:44 -07:00
parent e8dc61e910
commit 92aa526b9d

View File

@ -10,6 +10,7 @@ import (
"net"
"net/http"
"net/url"
"os"
"strings"
"time"
@ -61,8 +62,14 @@ 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,
gun,
server,
rt,