compose: Emit a change event when a container is renamed, so that the updated imageId and releaseId are reported

Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
This commit is contained in:
Pablo Carranza Velez 2018-03-13 18:12:47 -03:00
parent 62ad5ce3ba
commit 4ba4736aba

View File

@ -32,10 +32,9 @@ module.exports = class ServiceManager extends EventEmitter
if status?
@volatileState[containerId] ?= {}
_.merge(@volatileState[containerId], status)
@emit('change')
else if containerId? and @volatileState[containerId]?
delete @volatileState[containerId]
@emit('change')
@emit('change')
reportNewStatus: (containerId, service, status) =>
@reportChange(containerId, _.merge({ status }, _.pick(service, [ 'imageId', 'appId', 'releaseId', 'commit' ])))
@ -218,6 +217,8 @@ module.exports = class ServiceManager extends EventEmitter
@get(service)
.then (svc) =>
@docker.getContainer(svc.containerId).rename(name: "#{service.serviceName}_#{imageId}_#{releaseId}")
.then =>
@reportChange()
handover: (currentService, targetService) =>
# We set the running container to not restart so that in case of a poweroff