mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-19 05:37:51 +00:00
Update OS & config actions to the latest SDK
Fixes #915 Change-Type: patch
This commit is contained in:
parent
5d1d004b72
commit
892adf4c47
@ -279,7 +279,7 @@ exports.generate =
|
|||||||
normalizeUuidProp(options, 'device')
|
normalizeUuidProp(options, 'device')
|
||||||
Promise = require('bluebird')
|
Promise = require('bluebird')
|
||||||
writeFileAsync = Promise.promisify(require('fs').writeFile)
|
writeFileAsync = Promise.promisify(require('fs').writeFile)
|
||||||
resin = require('resin-sdk-preconfigured')
|
resin = require('resin-sdk').fromSharedOptions()
|
||||||
form = require('resin-cli-form')
|
form = require('resin-cli-form')
|
||||||
deviceConfig = require('resin-device-config')
|
deviceConfig = require('resin-device-config')
|
||||||
prettyjson = require('prettyjson')
|
prettyjson = require('prettyjson')
|
||||||
|
@ -31,7 +31,7 @@ resolveVersion = (deviceType, version) ->
|
|||||||
return Promise.resolve(version)
|
return Promise.resolve(version)
|
||||||
|
|
||||||
form = require('resin-cli-form')
|
form = require('resin-cli-form')
|
||||||
resin = require('resin-sdk-preconfigured')
|
resin = require('resin-sdk').fromSharedOptions()
|
||||||
|
|
||||||
resin.models.os.getSupportedVersions(deviceType)
|
resin.models.os.getSupportedVersions(deviceType)
|
||||||
.then ({ versions, recommended }) ->
|
.then ({ versions, recommended }) ->
|
||||||
@ -57,7 +57,7 @@ exports.versions =
|
|||||||
$ resin os versions raspberrypi3
|
$ resin os versions raspberrypi3
|
||||||
'''
|
'''
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
resin = require('resin-sdk-preconfigured')
|
resin = require('resin-sdk').fromSharedOptions()
|
||||||
|
|
||||||
resin.models.os.getSupportedVersions(params.type)
|
resin.models.os.getSupportedVersions(params.type)
|
||||||
.then ({ versions, recommended }) ->
|
.then ({ versions, recommended }) ->
|
||||||
@ -233,7 +233,7 @@ exports.configure =
|
|||||||
fs = require('fs')
|
fs = require('fs')
|
||||||
Promise = require('bluebird')
|
Promise = require('bluebird')
|
||||||
readFileAsync = Promise.promisify(fs.readFile)
|
readFileAsync = Promise.promisify(fs.readFile)
|
||||||
resin = require('resin-sdk-preconfigured')
|
resin = require('resin-sdk').fromSharedOptions()
|
||||||
init = require('resin-device-init')
|
init = require('resin-device-init')
|
||||||
helpers = require('../utils/helpers')
|
helpers = require('../utils/helpers')
|
||||||
patterns = require('../utils/patterns')
|
patterns = require('../utils/patterns')
|
||||||
|
@ -74,12 +74,12 @@ export function generateApplicationConfig(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function generateDeviceConfig(
|
export function generateDeviceConfig(
|
||||||
device: ResinSdk.Device & { application_name: string },
|
device: ResinSdk.Device & { belongs_to__application: ResinSdk.PineDeferred },
|
||||||
deviceApiKey: string | true | null,
|
deviceApiKey: string | true | null,
|
||||||
options: {},
|
options: {},
|
||||||
) {
|
) {
|
||||||
return resin.models.application
|
return resin.models.application
|
||||||
.get(device.application_name)
|
.get(device.belongs_to__application.__id)
|
||||||
.then(application => {
|
.then(application => {
|
||||||
return generateBaseConfig(application, options).tap(config => {
|
return generateBaseConfig(application, options).tap(config => {
|
||||||
// Device API keys are only safe for ResinOS 2.0.3+. We could somehow obtain
|
// Device API keys are only safe for ResinOS 2.0.3+. We could somehow obtain
|
||||||
|
Loading…
Reference in New Issue
Block a user