trust: update references when pulling

Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
This commit is contained in:
Riyaz Faizullabhoy 2017-10-06 14:46:17 -07:00
parent fb7a817583
commit 067fff8b03
2 changed files with 9 additions and 1 deletions

View File

@ -54,6 +54,10 @@ func runPull(cli command.Cli, opts pullOptions) error {
if !opts.all && reference.IsNameOnly(distributionRef) { if !opts.all && reference.IsNameOnly(distributionRef) {
distributionRef = reference.TagNameOnly(distributionRef) distributionRef = reference.TagNameOnly(distributionRef)
imgRefAndAuth, err = trust.GetImageReferencesAndAuth(ctx, AuthResolver(cli), distributionRef.String())
if err != nil {
return err
}
if tagged, ok := distributionRef.(reference.Tagged); ok { if tagged, ok := distributionRef.(reference.Tagged); ok {
fmt.Fprintf(cli.Out(), "Using default tag: %s\n", tagged.Tag()) fmt.Fprintf(cli.Out(), "Using default tag: %s\n", tagged.Tag())
} }

View File

@ -200,7 +200,11 @@ func trustedPull(ctx context.Context, cli command.Cli, imgRefAndAuth trust.Image
if err != nil { if err != nil {
return err return err
} }
if err := imagePullPrivileged(ctx, cli, imgRefAndAuth, false); err != nil { updatedImgRefAndAuth, err := trust.GetImageReferencesAndAuth(ctx, AuthResolver(cli), trustedRef.String())
if err != nil {
return err
}
if err := imagePullPrivileged(ctx, cli, updatedImgRefAndAuth, false); err != nil {
return err return err
} }