Auto-merge for PR #467 via VersionBot

Replace edge device type with generic-amd64
This commit is contained in:
resin-io-versionbot[bot] 2017-07-07 18:37:25 +00:00 committed by GitHub
commit c84a269947
4 changed files with 23 additions and 14 deletions

View File

@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY! automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
This project adheres to [Semantic Versioning](http://semver.org/). This project adheres to [Semantic Versioning](http://semver.org/).
## v6.0.0 - 2017-07-07
* Deprecate edge device type [Joe Roberts]
## v5.1.1 - 2017-07-04 ## v5.1.1 - 2017-07-04
* Fix semver comparison for OS version when determining if the device has deviceApiKey support [Pablo Carranza Velez] * Fix semver comparison for OS version when determining if the device has deviceApiKey support [Pablo Carranza Velez]

View File

@ -57,14 +57,12 @@ curl -X GET $RESIN_SUPERVISOR_ADDRESS/v1/dependent-apps?apikey=$RESIN_SUPERVISOR
[ [
{ {
"id": 13015, "id": 13015,
"device_type": "edge",
"name": "edgeApp1", "name": "edgeApp1",
"commit": "d43bea5e16658e653088ce4b9a91b6606c3c2a0d", "commit": "d43bea5e16658e653088ce4b9a91b6606c3c2a0d",
"config": {} "config": {}
}, },
{ {
"id": 13016, "id": 13016,
"device_type": "edge",
"name": "edgeApp2", "name": "edgeApp2",
"commit": "d0f6624d6410fa079159fa3ebe0d3af46753d75d", "commit": "d0f6624d6410fa079159fa3ebe0d3af46753d75d",
"config": {} "config": {}
@ -110,7 +108,7 @@ curl -X GET $RESIN_SUPERVISOR_ADDRESS/v1/devices?apikey=$RESIN_SUPERVISOR_API_KE
"id": 1, "id": 1,
"uuid": "5ae8cf6e062c033ea38435498ad9b487bcc714e9eab0fed0404ee56e397790", "uuid": "5ae8cf6e062c033ea38435498ad9b487bcc714e9eab0fed0404ee56e397790",
"appId": 13015, "appId": 13015,
"device_type": "edge", "device_type": "generic-amd64",
"logs_channel": "69f961abffaad1ff66031b29f712be4fb19e1bfabf1fee7a9ebfb5fa75a1fbdb", "logs_channel": "69f961abffaad1ff66031b29f712be4fb19e1bfabf1fee7a9ebfb5fa75a1fbdb",
"deviceId": "47270", "deviceId": "47270",
"is_online": null, "is_online": null,
@ -128,7 +126,7 @@ curl -X GET $RESIN_SUPERVISOR_ADDRESS/v1/devices?apikey=$RESIN_SUPERVISOR_API_KE
"id": 3, "id": 3,
"uuid": "8dc608765fd32665d49d218a7eb4657bc2ab8a56db06d2c57ef7c7e9a115da", "uuid": "8dc608765fd32665d49d218a7eb4657bc2ab8a56db06d2c57ef7c7e9a115da",
"appId": 13015, "appId": 13015,
"device_type": "edge", "device_type": "generic-amd64",
"logs_channel": "d0244a90e8cd6e9a1ab410d3d599dea7f15110a6fe37b2a8fd69bb6ee0bce043", "logs_channel": "d0244a90e8cd6e9a1ab410d3d599dea7f15110a6fe37b2a8fd69bb6ee0bce043",
"deviceId": "47318", "deviceId": "47318",
"is_online": null, "is_online": null,
@ -148,10 +146,15 @@ curl -X GET $RESIN_SUPERVISOR_ADDRESS/v1/devices?apikey=$RESIN_SUPERVISOR_API_KE
### POST /v1/devices ### POST /v1/devices
Dependent Device Provision Dependent Device Provision
The `device_type` parameter is optional, defaulting to `generic-amd64`. You
should only set this if you need to provision a dependent device to an
application with the deprecated `edge` device type.
**Example** **Example**
```bash ```bash
curl -H "Content-Type: application/json" -X POST --data '{"appId": <appId>}' / curl -H "Content-Type: application/json" -X POST --data '{"appId": <appId>,
"device_type": "edge"}' /
$RESIN_SUPERVISOR_ADDRESS/v1/devices?apikey=$RESIN_SUPERVISOR_API_KEY $RESIN_SUPERVISOR_ADDRESS/v1/devices?apikey=$RESIN_SUPERVISOR_API_KEY
``` ```
@ -162,10 +165,10 @@ $RESIN_SUPERVISOR_ADDRESS/v1/devices?apikey=$RESIN_SUPERVISOR_API_KEY
```javascript ```javascript
{ {
"id": 47318, "id": 47318,
"uuid": "8dc608765fd32665d49a268a7eb4657bc2ab8a56db06d2c57ef7c7e9a115da", "uuid": "8dc608765fd32665d49a268a7eb4657bc2ab8a56db06d2c57ef7c7e9a115da",
"name": "wild-paper", "name": "wild-paper",
"note": null, "note": null,
"device_type": "edge", "device_type": "edge"
} }
``` ```
@ -186,7 +189,7 @@ curl -X GET $RESIN_SUPERVISOR_ADDRESS/v1/devices/<uuid>?apikey=$RESIN_SUPERVISOR
"id": 1, "id": 1,
"uuid": "5ae8cf6e062c033ea57837498ad9b487bfc714e9eab0fed0404ee56e397790", "uuid": "5ae8cf6e062c033ea57837498ad9b487bfc714e9eab0fed0404ee56e397790",
"appId": 13015, "appId": 13015,
"device_type": "edge", "device_type": "generic-amd64",
"logs_channel": "69f961abffaad2ff00031b29f718be4fb19e1bfabf1fee7a9ebfb5fa75a1fbdb", "logs_channel": "69f961abffaad2ff00031b29f718be4fb19e1bfabf1fee7a9ebfb5fa75a1fbdb",
"deviceId": "47270", "deviceId": "47270",
"is_online": null, "is_online": null,
@ -219,7 +222,7 @@ $RESIN_SUPERVISOR_ADDRESS/v1/devices/<uuid>?apikey=$RESIN_SUPERVISOR_API_KEY
"id": 1, "id": 1,
"uuid": "5ae8cf6e062c033ea38437498ad9b482bcc714e9eab0fed0404ee56e397790", "uuid": "5ae8cf6e062c033ea38437498ad9b482bcc714e9eab0fed0404ee56e397790",
"appId": 13015, "appId": 13015,
"device_type": "edge", "device_type": "generic-amd64",
"logs_channel": "69f961abffaad2ff66031b29f712be4fb19e1bfabf1fee7a9ebfb5fa05a1fbdb", "logs_channel": "69f961abffaad2ff66031b29f712be4fb19e1bfabf1fee7a9ebfb5fa05a1fbdb",
"deviceId": "47270", "deviceId": "47270",
"is_online": true, "is_online": true,

View File

@ -1,7 +1,7 @@
{ {
"name": "resin-supervisor", "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.", "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": "5.1.1", "version": "6.0.0",
"license": "Apache-2.0", "license": "Apache-2.0",
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -42,10 +42,13 @@ router.get '/v1/devices', (req, res) ->
res.status(503).send(err?.message or err or 'Unknown error') res.status(503).send(err?.message or err or 'Unknown error')
router.post '/v1/devices', (req, res) -> router.post '/v1/devices', (req, res) ->
appId = req.body.appId { appId, device_type } = req.body
if !appId? or _.isNaN(parseInt(appId)) or parseInt(appId) <= 0 if !appId? or _.isNaN(parseInt(appId)) or parseInt(appId) <= 0
res.status(400).send('appId must be a positive integer') res.status(400).send('appId must be a positive integer')
return return
device_type = 'generic-amd64' if !device_type?
Promise.join( Promise.join(
utils.getConfig('apiKey') utils.getConfig('apiKey')
utils.getConfig('userId') utils.getConfig('userId')
@ -57,7 +60,7 @@ router.post '/v1/devices', (req, res) ->
user: userId user: userId
application: req.body.appId application: req.body.appId
uuid: uuid uuid: uuid
device_type: 'edge' device_type: device_type
device: deviceId device: deviceId
registered_at: Math.floor(Date.now() / 1000) registered_at: Math.floor(Date.now() / 1000)
logs_channel: logsChannel logs_channel: logsChannel
@ -203,7 +206,6 @@ router.get '/v1/dependent-apps', (req, res) ->
return { return {
id: parseInt(app.appId) id: parseInt(app.appId)
commit: app.commit commit: app.commit
device_type: 'edge'
name: app.name name: app.name
config: JSON.parse(app.config ? '{}') config: JSON.parse(app.config ? '{}')
} }