Merge pull request #46300 from thaJeztah/24.0_backport_fix-platform-check
[24.0 backport] Don't return an error if the lease is not found
This commit is contained in:
commit
e0661af25c
1 changed files with 7 additions and 4 deletions
|
@ -54,10 +54,13 @@ func (i *ImageService) PrepareSnapshot(ctx context.Context, id string, image str
|
||||||
func (i *ImageService) manifestMatchesPlatform(ctx context.Context, img *image.Image, platform ocispec.Platform) (bool, error) {
|
func (i *ImageService) manifestMatchesPlatform(ctx context.Context, img *image.Image, platform ocispec.Platform) (bool, error) {
|
||||||
logger := logrus.WithField("image", img.ID).WithField("desiredPlatform", platforms.Format(platform))
|
logger := logrus.WithField("image", img.ID).WithField("desiredPlatform", platforms.Format(platform))
|
||||||
|
|
||||||
ls, leaseErr := i.leases.ListResources(ctx, leases.Lease{ID: imageKey(img.ID().String())})
|
ls, err := i.leases.ListResources(ctx, leases.Lease{ID: imageKey(img.ID().String())})
|
||||||
if leaseErr != nil {
|
if err != nil {
|
||||||
logger.WithError(leaseErr).Error("Error looking up image leases")
|
if cerrdefs.IsNotFound(err) {
|
||||||
return false, leaseErr
|
return false, nil
|
||||||
|
}
|
||||||
|
logger.WithError(err).Error("Error looking up image leases")
|
||||||
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note we are comparing against manifest lists here, which we expect to always have a CPU variant set (where applicable).
|
// Note we are comparing against manifest lists here, which we expect to always have a CPU variant set (where applicable).
|
||||||
|
|
Loading…
Reference in a new issue