mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-02-20 17:52:51 +00:00
fix: Rework delete-then-download handling in state engine
In the original implementation it was possible that the delete did not wait for the kill step to be finished, so it would not be deleted. We seperate this process into two steps, to allow for the container to have stopped before proceeding. Change-type: patch Closes: #841 Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
parent
9d8552ea8d
commit
e9b51bbcd7
@ -545,8 +545,8 @@ module.exports = class ApplicationManager extends EventEmitter
|
||||
return null
|
||||
'kill-then-download': (current, target) ->
|
||||
return serviceAction('kill', target.serviceId, current, target)
|
||||
'delete-then-download': (current, target, needsDownload) ->
|
||||
return serviceAction('kill', target.serviceId, current, target, removeImage: needsDownload)
|
||||
'delete-then-download': (current, target) ->
|
||||
return serviceAction('kill', target.serviceId, current, target)
|
||||
'hand-over': (current, target, needsDownload, dependenciesMetForStart, dependenciesMetForKill, needsSpecialKill, timeout) ->
|
||||
if needsDownload
|
||||
return fetchAction(target)
|
||||
@ -849,7 +849,10 @@ module.exports = class ApplicationManager extends EventEmitter
|
||||
return @bestDeltaSource(image, available)
|
||||
proxyvisorImages = @proxyvisor.imagesInUse(current, target)
|
||||
|
||||
imagesToRemove = _.filter availableAndUnused, (image) ->
|
||||
potentialDeleteThenDownload = _.filter current.local.apps.services, (svc) ->
|
||||
svc.config.labels['io.balena.update.strategy'] == 'delete-then-download' and svc.status == 'Stopped'
|
||||
|
||||
imagesToRemove = _.filter availableAndUnused.concat(potentialDeleteThenDownload), (image) ->
|
||||
notUsedForDelta = !_.includes(deltaSources, image.name)
|
||||
notUsedByProxyvisor = !_.some proxyvisorImages, (proxyvisorImage) -> Images.isSameImage(image, { name: proxyvisorImage })
|
||||
return notUsedForDelta and notUsedByProxyvisor
|
||||
|
Loading…
x
Reference in New Issue
Block a user