mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-05-31 06:41:05 +00:00
Auto-merge for PR #579 via VersionBot
Some fixes for the supervisor API
This commit is contained in:
commit
7df07482d1
@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file
|
||||
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
|
||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## v7.1.8 - 2018-03-13
|
||||
|
||||
* Avoid trying to send a response to API calls after we've already sent an error #579 [Pablo Carranza Velez]
|
||||
* Fix passing a target service to start in /v1/apps/:appId/start, and getting the containerId #579 [Pablo Carranza Velez]
|
||||
|
||||
## v7.1.7 - 2018-03-09
|
||||
|
||||
* Gosuper: Treat systemd unit states that are not "inactive" or "deactivating" as enabled states #577 [Pablo Carranza Velez]
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "resin-supervisor",
|
||||
"description": "This is resin.io's Supervisor, a program that runs on IoT devices and has the task of running user Apps (which are Docker containers), and updating them as Resin's API informs it to.",
|
||||
"version": "7.1.7",
|
||||
"version": "7.1.8",
|
||||
"license": "Apache-2.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -127,9 +127,19 @@ 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 })
|
||||
.then (service) ->
|
||||
res.status(200).json({ containerId: service.containerId })
|
||||
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?
|
||||
throw new Error('App not found after running action')
|
||||
return service
|
||||
.then (service) ->
|
||||
res.status(200).json({ containerId: service.containerId })
|
||||
.catch (err) ->
|
||||
res.status(503).send(err?.message or err or 'Unknown error')
|
||||
|
||||
@ -203,8 +213,8 @@ createApplicationManagerRouter = (applications) ->
|
||||
return res.status(404).send(errMsg)
|
||||
applications.setTargetVolatileForService(service.imageId, running: action != 'stop')
|
||||
applications.executeStepAction(serviceAction(action, service.serviceId, service, service, { wait: true }), { skipLock: true })
|
||||
.then ->
|
||||
res.status(200).send('OK')
|
||||
.then ->
|
||||
res.status(200).send('OK')
|
||||
.catch (err) ->
|
||||
res.status(503).send(err?.message or err or 'Unknown error')
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user