improve code

This commit is contained in:
tanshanshan
2017-09-26 19:49:56 +08:00
parent b188868fd9
commit f6ea2a61da
4 changed files with 9 additions and 6 deletions

View File

@@ -92,8 +92,11 @@ func (rp *remotePuller) Name() string {
}
func (rp *remotePuller) Pull(image string) ([]byte, error) {
// TODO(runcom): should we check if the image is already pulled with ImageStatus?
_, err := rp.imageService.PullImage(&runtimeapi.ImageSpec{Image: image}, nil)
imageStatus, err := rp.imageService.ImageStatus(&runtimeapi.ImageSpec{Image: image})
if err == nil && imageStatus != nil {
return nil, nil
}
_, err = rp.imageService.PullImage(&runtimeapi.ImageSpec{Image: image}, nil)
return nil, err
}