mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-20 06:07:57 +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?
|
||||||
registerDevice(userConfig.apiKey, userConfig.userId, userConfig.applicationId, userConfig.deviceType)
|
return userConfig.uuid
|
||||||
.then (uuid) ->
|
registerDevice(userConfig.apiKey, userConfig.userId, userConfig.applicationId, userConfig.deviceType)
|
||||||
userConfig.uuid = uuid
|
.tap (uuid) ->
|
||||||
resolve(uuid)
|
userConfig.uuid = 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