Skip to content

Commit

Permalink
Work around podman bug in api/image_exists
Browse files Browse the repository at this point in the history
It should be fixed in podman 3 via
containers/podman@3fa61f0
  • Loading branch information
towe75 committed Feb 2, 2021
1 parent 184f0bc commit 8fd1872
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions api/image_exists.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@ func (c *API) ImageExists(ctx context.Context, nameWithTag string) (bool, error)
if res.StatusCode == http.StatusNoContent {
return true, nil
}
if res.StatusCode == http.StatusInternalServerError {
return true, nil
}
return false, fmt.Errorf("unknown error, status code: %d", res.StatusCode)
}
4 changes: 3 additions & 1 deletion driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,9 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive
// do we already have this image in local storage?
haveImage, err := d.podman.ImageExists(d.ctx, createOpts.Image)
if err != nil {
return nil, nil, fmt.Errorf("failed to start task, unable to check for local image: %v", err)
// we assume that we do NOT have a local image if something goes wrong
// it could work to pull/start a container
d.logger.Warn("failed to check for local image", "image", createOpts.Image, "err", err)
}
if !haveImage {
// image is not in local storage, so we need to pull it
Expand Down

0 comments on commit 8fd1872

Please sign in to comment.