mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-19 21:57:54 +00:00
Fix passing a target service to start in /v1/apps/:appId/start, and getting the containerId
We weren't passing a "target" to serviceAction, which made the start action fail. Plus we need to get the container again after starting to get the latest containerId. Change-Type: patch Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
This commit is contained in:
parent
f4e07e3ce8
commit
79b4d39acd
@ -127,7 +127,17 @@ createApplicationManagerRouter = (applications) ->
|
||||
if app.services.length > 1
|
||||
return res.status(400).send('Some v1 endpoints are only allowed on single-container apps')
|
||||
applications.setTargetVolatileForService(service.imageId, running: action != 'stop')
|
||||
applications.executeStepAction(serviceAction(action, service.serviceId, service), { force })
|
||||
applications.executeStepAction(serviceAction(action, service.serviceId, service, service), { force })
|
||||
.then ->
|
||||
if action == 'stop'
|
||||
return service
|
||||
# We refresh the container id in case we were starting an app with no container yet
|
||||
applications.getCurrentApp(appId)
|
||||
.then (app) ->
|
||||
service = app?.services?[0]
|
||||
if !service?
|
||||
return res.status(400).send('App not found after running action')
|
||||
return service
|
||||
.then (service) ->
|
||||
res.status(200).json({ containerId: service.containerId })
|
||||
.catch (err) ->
|
||||
|
Loading…
Reference in New Issue
Block a user