mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-01 15:07:17 +08:00
fix: allow uncache deleted image (#24349)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
This commit is contained in:
@@ -432,6 +432,9 @@ func (manager *SCachedimageManager) getImageByName(ctx context.Context, userCred
|
||||
s := auth.GetSession(ctx, userCred, options.Options.Region)
|
||||
obj, err := image.Images.GetByName(s, imageId, nil)
|
||||
if err != nil {
|
||||
if httputils.ErrorCode(err) == 404 {
|
||||
err = httperrors.ErrNotFound
|
||||
}
|
||||
return nil, errors.Wrap(err, "modules.Images.GetByName")
|
||||
}
|
||||
cachedImage, err := manager.cacheGlanceImageInfo(ctx, userCred, obj)
|
||||
|
||||
@@ -588,10 +588,10 @@ func (sc *SStoragecache) PerformUncacheImage(ctx context.Context, userCred mccli
|
||||
}
|
||||
imageId = imgObj.GetId()
|
||||
_, err := CachedimageManager.getImageInfo(ctx, userCred, imageStr, isForce)
|
||||
if err != nil {
|
||||
log.Infof("image %s not found %s", imageStr, err)
|
||||
if err != nil && errors.Cause(err) != httperrors.ErrNotFound {
|
||||
log.Infof("get image %s info error %s", imageStr, err)
|
||||
if !isForce {
|
||||
return nil, httperrors.NewImageNotFoundError(imageStr)
|
||||
return nil, errors.Wrapf(err, "get image %s info", imageStr)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user