Skip to content

Commit

Permalink
check image
Browse files Browse the repository at this point in the history
  • Loading branch information
CMGS committed Aug 27, 2018
1 parent 8724215 commit 090e57b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions cluster/calcium/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ func pullImage(ctx context.Context, node *types.Node, image, auth string) error
return fmt.Errorf("Goddamn empty image, WTF?")
}

// check local
exists := false
image = utils.NormalizeImageName(image)
f := filters.NewArgs()
f.Add("reference", image)
Expand All @@ -205,12 +207,15 @@ func pullImage(ctx context.Context, node *types.Node, image, auth string) error
listResp, err := node.Engine.ImageList(ctx, listOptions)
if err != nil {
log.Errorf("[pullImage] Error during check image %s: %v", image, err)
return err
}
//TODO check remote to update same image

if len(listResp) > 0 {
log.Debugf("[pullImage] Image %s exists", image)
exists = true
}

if exists {
log.Infof("[pullImage] Image cached, skip pulling")
return nil
}

Expand Down

0 comments on commit 090e57b

Please sign in to comment.