mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-24 15:56:40 +00:00
use promise.try to start promise chain
This commit is contained in:
parent
2d4c22d6eb
commit
4cf6ce657a
@ -37,17 +37,12 @@ module.exports = ->
|
|||||||
userConfig = require('/boot/config.json')
|
userConfig = require('/boot/config.json')
|
||||||
userConfig.deviceType ?= 'Raspberry Pi'
|
userConfig.deviceType ?= 'Raspberry Pi'
|
||||||
|
|
||||||
new Promise (resolve, reject) ->
|
Promise.try ->
|
||||||
if not userConfig.uuid?
|
if userConfig.uuid?
|
||||||
|
return userConfig.uuid
|
||||||
registerDevice(userConfig.apiKey, userConfig.userId, userConfig.applicationId, userConfig.deviceType)
|
registerDevice(userConfig.apiKey, userConfig.userId, userConfig.applicationId, userConfig.deviceType)
|
||||||
.then (uuid) ->
|
.tap (uuid) ->
|
||||||
userConfig.uuid = uuid
|
userConfig.uuid = uuid
|
||||||
resolve(uuid)
|
|
||||||
.catch (err) ->
|
|
||||||
reject(err)
|
|
||||||
else
|
|
||||||
uuid = userConfig.uuid
|
|
||||||
resolve(uuid)
|
|
||||||
.then (uuid) ->
|
.then (uuid) ->
|
||||||
version = utils.getSupervisorVersion()
|
version = utils.getSupervisorVersion()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user