mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-23 15:32:24 +00:00
ApplicationManager: try to match available images by imageId to avoid keeping around unused image entries in the db
This should fix an issue where, on an update that only changes container metadata, the image install for the old image is kept around on the API. Change-Type: patch Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
This commit is contained in:
parent
4ba4736aba
commit
0101d62ace
@ -903,7 +903,8 @@ module.exports = class ApplicationManager extends EventEmitter
|
||||
allImagesForTargetApp = (app) -> _.map(app.services, imageForService)
|
||||
allImagesForCurrentApp = (app) ->
|
||||
_.map app.services, (service) ->
|
||||
_.omit(_.find(available, { dockerImageId: service.image }), [ 'dockerImageId', 'id' ])
|
||||
img = _.find(available, { dockerImageId: service.image, imageId: service.imageId }) ? _.find(available, { dockerImageId: service.image })
|
||||
return _.omit(img, [ 'dockerImageId', 'id' ])
|
||||
availableWithoutIds = _.map(available, (image) -> _.omit(image, [ 'dockerImageId', 'id' ]))
|
||||
currentImages = _.flatMap(current.local.apps, allImagesForCurrentApp)
|
||||
targetImages = _.flatMap(target.local.apps, allImagesForTargetApp)
|
||||
|
Loading…
Reference in New Issue
Block a user