mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-01-31 16:35:23 +00:00
Ensure we have the deviceId by GETting it from the Resin API
This commit is contained in:
parent
198975fcb1
commit
8eb1c3ea7b
@ -34,10 +34,18 @@ bootstrap = ->
|
||||
return userConfig
|
||||
deviceRegister.register(resinApi, userConfig)
|
||||
.catch DuplicateUuidError, ->
|
||||
return {}
|
||||
resinApi.get
|
||||
resource: 'device'
|
||||
options:
|
||||
filter:
|
||||
uuid: userConfig.uuid
|
||||
customOptions:
|
||||
apikey: userConfig.apiKey
|
||||
.then ([ device ]) ->
|
||||
return device
|
||||
.then (device) ->
|
||||
userConfig.registered_at = Date.now()
|
||||
userConfig.deviceId = device.id if device.id?
|
||||
userConfig.deviceId = device.id
|
||||
fs.writeFileAsync(configPath, JSON.stringify(userConfig))
|
||||
.return(userConfig)
|
||||
.then (userConfig) ->
|
||||
|
Loading…
x
Reference in New Issue
Block a user