Update OS & config actions to the latest SDK

Fixes #915
Change-Type: patch
This commit is contained in:
Tim Perry 2018-07-11 18:57:26 +02:00
parent 5d1d004b72
commit 892adf4c47
3 changed files with 6 additions and 6 deletions

View File

@ -279,7 +279,7 @@ exports.generate =
normalizeUuidProp(options, 'device')
Promise = require('bluebird')
writeFileAsync = Promise.promisify(require('fs').writeFile)
resin = require('resin-sdk-preconfigured')
resin = require('resin-sdk').fromSharedOptions()
form = require('resin-cli-form')
deviceConfig = require('resin-device-config')
prettyjson = require('prettyjson')

View File

@ -31,7 +31,7 @@ resolveVersion = (deviceType, version) ->
return Promise.resolve(version)
form = require('resin-cli-form')
resin = require('resin-sdk-preconfigured')
resin = require('resin-sdk').fromSharedOptions()
resin.models.os.getSupportedVersions(deviceType)
.then ({ versions, recommended }) ->
@ -57,7 +57,7 @@ exports.versions =
$ resin os versions raspberrypi3
'''
action: (params, options, done) ->
resin = require('resin-sdk-preconfigured')
resin = require('resin-sdk').fromSharedOptions()
resin.models.os.getSupportedVersions(params.type)
.then ({ versions, recommended }) ->
@ -233,7 +233,7 @@ exports.configure =
fs = require('fs')
Promise = require('bluebird')
readFileAsync = Promise.promisify(fs.readFile)
resin = require('resin-sdk-preconfigured')
resin = require('resin-sdk').fromSharedOptions()
init = require('resin-device-init')
helpers = require('../utils/helpers')
patterns = require('../utils/patterns')

View File

@ -74,12 +74,12 @@ export function generateApplicationConfig(
}
export function generateDeviceConfig(
device: ResinSdk.Device & { application_name: string },
device: ResinSdk.Device & { belongs_to__application: ResinSdk.PineDeferred },
deviceApiKey: string | true | null,
options: {},
) {
return resin.models.application
.get(device.application_name)
.get(device.belongs_to__application.__id)
.then(application => {
return generateBaseConfig(application, options).tap(config => {
// Device API keys are only safe for ResinOS 2.0.3+. We could somehow obtain