ApplicationManager: only use dockerImageId to identify images for current apps, to avoid trying to delete an image that is in use

Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
This commit is contained in:
Pablo Carranza Velez 2018-03-09 06:24:42 -08:00
parent bc153ffe5d
commit b6631b7367

View File

@ -892,7 +892,7 @@ module.exports = class ApplicationManager extends EventEmitter
allImagesForTargetApp = (app) -> _.map(app.services, imageForService)
allImagesForCurrentApp = (app) ->
_.map app.services, (service) ->
_.omit(_.find(available, { dockerImageId: service.image, imageId: service.imageId }), [ 'dockerImageId', 'id' ])
_.omit(_.find(available, { dockerImageId: service.image }), [ 'dockerImageId', 'id' ])
availableWithoutIds = _.map(available, (image) -> _.omit(image, [ 'dockerImageId', 'id' ]))
currentImages = _.flatMap(current.local.apps, allImagesForCurrentApp)
targetImages = _.flatMap(target.local.apps, allImagesForTargetApp)