Merge pull request #911 from resin-io/fix_pre_provision

Device api keys are no longer used in the registration process
This commit is contained in:
Tim Perry 2018-09-10 15:33:37 +02:00 committed by GitHub
commit eed3c06789
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 19 deletions

View File

@ -388,13 +388,10 @@ Examples:
Use this command to register a device to an application.
Note that device api keys are only supported on ResinOS 2.0.3+
Examples:
$ resin device register MyApp
$ resin device register MyApp --uuid <uuid>
$ resin device register MyApp --uuid <uuid> --device-api-key <existingDeviceKey>
### Options
@ -402,10 +399,6 @@ Examples:
custom uuid
#### --deviceApiKey, -k &#60;device-api-key&#62;
custom device key - note that this is only supported on ResinOS 2.0.3+
## device rm &#60;uuid&#62;
Use this command to remove a device from resin.io.

View File

@ -142,13 +142,10 @@ exports.register =
help: '''
Use this command to register a device to an application.
Note that device api keys are only supported on ResinOS 2.0.3+
Examples:
$ resin device register MyApp
$ resin device register MyApp --uuid <uuid>
$ resin device register MyApp --uuid <uuid> --device-api-key <existingDeviceKey>
'''
permission: 'user'
options: [
@ -158,7 +155,6 @@ exports.register =
parameter: 'uuid'
alias: 'u'
}
commandOptions.optionalDeviceApiKey
]
action: (params, options, done) ->
Promise = require('bluebird')
@ -167,14 +163,8 @@ exports.register =
Promise.join(
resin.models.application.get(params.application)
options.uuid ? resin.models.device.generateUniqueKey()
options.deviceApiKey ? resin.models.device.generateUniqueKey()
(application, uuid, deviceApiKey) ->
console.info("Registering to #{application.app_name}: #{uuid}")
if not options.deviceApiKey?
console.info("Using generated device api key: #{deviceApiKey}")
else
console.info('Using provided device api key')
return resin.models.device.register(application.id, uuid, deviceApiKey)
(application, uuid) ->
return resin.models.device.register(application.id, uuid)
)
.get('uuid')
.nodeify(done)