mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-24 07:46:39 +00:00
Auto-merge for PR #774 via VersionBot
Fix uuid params being parsed a numbers
This commit is contained in:
commit
b96065514f
@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file
|
|||||||
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
|
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
|
||||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
|
## v6.12.8 - 2018-02-03
|
||||||
|
|
||||||
|
* Fix uuid params being parsed a numbers #774 [Thodoris Greasidis]
|
||||||
|
|
||||||
## v6.12.7 - 2018-01-30
|
## v6.12.7 - 2018-01-30
|
||||||
|
|
||||||
* Add 'or mounted resinOS image' #767 [MoranF]
|
* Add 'or mounted resinOS image' #767 [MoranF]
|
||||||
|
@ -15,6 +15,7 @@ limitations under the License.
|
|||||||
###
|
###
|
||||||
|
|
||||||
commandOptions = require('./command-options')
|
commandOptions = require('./command-options')
|
||||||
|
{ normalizeUuidProp } = require('../utils/normalization')
|
||||||
|
|
||||||
exports.read =
|
exports.read =
|
||||||
signature: 'config read'
|
signature: 'config read'
|
||||||
@ -269,6 +270,7 @@ exports.generate =
|
|||||||
]
|
]
|
||||||
permission: 'user'
|
permission: 'user'
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
|
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-preconfigured')
|
||||||
|
@ -16,6 +16,7 @@ limitations under the License.
|
|||||||
|
|
||||||
commandOptions = require('./command-options')
|
commandOptions = require('./command-options')
|
||||||
_ = require('lodash')
|
_ = require('lodash')
|
||||||
|
{ normalizeUuidProp } = require('../utils/normalization')
|
||||||
|
|
||||||
exports.list =
|
exports.list =
|
||||||
signature: 'devices'
|
signature: 'devices'
|
||||||
@ -77,6 +78,7 @@ exports.info =
|
|||||||
permission: 'user'
|
permission: 'user'
|
||||||
primary: true
|
primary: true
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
|
normalizeUuidProp(params)
|
||||||
resin = require('resin-sdk-preconfigured')
|
resin = require('resin-sdk-preconfigured')
|
||||||
visuals = require('resin-cli-visuals')
|
visuals = require('resin-cli-visuals')
|
||||||
|
|
||||||
@ -185,6 +187,7 @@ exports.remove =
|
|||||||
options: [ commandOptions.yes ]
|
options: [ commandOptions.yes ]
|
||||||
permission: 'user'
|
permission: 'user'
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
|
normalizeUuidProp(params)
|
||||||
resin = require('resin-sdk-preconfigured')
|
resin = require('resin-sdk-preconfigured')
|
||||||
patterns = require('../utils/patterns')
|
patterns = require('../utils/patterns')
|
||||||
|
|
||||||
@ -206,6 +209,7 @@ exports.identify =
|
|||||||
'''
|
'''
|
||||||
permission: 'user'
|
permission: 'user'
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
|
normalizeUuidProp(params)
|
||||||
resin = require('resin-sdk-preconfigured')
|
resin = require('resin-sdk-preconfigured')
|
||||||
resin.models.device.identify(params.uuid).nodeify(done)
|
resin.models.device.identify(params.uuid).nodeify(done)
|
||||||
|
|
||||||
@ -222,6 +226,7 @@ exports.reboot =
|
|||||||
options: [ commandOptions.forceUpdateLock ]
|
options: [ commandOptions.forceUpdateLock ]
|
||||||
permission: 'user'
|
permission: 'user'
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
|
normalizeUuidProp(params)
|
||||||
resin = require('resin-sdk-preconfigured')
|
resin = require('resin-sdk-preconfigured')
|
||||||
resin.models.device.reboot(params.uuid, options).nodeify(done)
|
resin.models.device.reboot(params.uuid, options).nodeify(done)
|
||||||
|
|
||||||
@ -238,6 +243,7 @@ exports.shutdown =
|
|||||||
options: [ commandOptions.forceUpdateLock ]
|
options: [ commandOptions.forceUpdateLock ]
|
||||||
permission: 'user'
|
permission: 'user'
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
|
normalizeUuidProp(params)
|
||||||
resin = require('resin-sdk-preconfigured')
|
resin = require('resin-sdk-preconfigured')
|
||||||
resin.models.device.shutdown(params.uuid, options).nodeify(done)
|
resin.models.device.shutdown(params.uuid, options).nodeify(done)
|
||||||
|
|
||||||
@ -253,6 +259,7 @@ exports.enableDeviceUrl =
|
|||||||
'''
|
'''
|
||||||
permission: 'user'
|
permission: 'user'
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
|
normalizeUuidProp(params)
|
||||||
resin = require('resin-sdk-preconfigured')
|
resin = require('resin-sdk-preconfigured')
|
||||||
resin.models.device.enableDeviceUrl(params.uuid).nodeify(done)
|
resin.models.device.enableDeviceUrl(params.uuid).nodeify(done)
|
||||||
|
|
||||||
@ -268,6 +275,7 @@ exports.disableDeviceUrl =
|
|||||||
'''
|
'''
|
||||||
permission: 'user'
|
permission: 'user'
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
|
normalizeUuidProp(params)
|
||||||
resin = require('resin-sdk-preconfigured')
|
resin = require('resin-sdk-preconfigured')
|
||||||
resin.models.device.disableDeviceUrl(params.uuid).nodeify(done)
|
resin.models.device.disableDeviceUrl(params.uuid).nodeify(done)
|
||||||
|
|
||||||
@ -283,6 +291,7 @@ exports.getDeviceUrl =
|
|||||||
'''
|
'''
|
||||||
permission: 'user'
|
permission: 'user'
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
|
normalizeUuidProp(params)
|
||||||
resin = require('resin-sdk-preconfigured')
|
resin = require('resin-sdk-preconfigured')
|
||||||
resin.models.device.getDeviceUrl(params.uuid).then (url) ->
|
resin.models.device.getDeviceUrl(params.uuid).then (url) ->
|
||||||
console.log(url)
|
console.log(url)
|
||||||
@ -300,6 +309,7 @@ exports.hasDeviceUrl =
|
|||||||
'''
|
'''
|
||||||
permission: 'user'
|
permission: 'user'
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
|
normalizeUuidProp(params)
|
||||||
resin = require('resin-sdk-preconfigured')
|
resin = require('resin-sdk-preconfigured')
|
||||||
resin.models.device.hasDeviceUrl(params.uuid).then (hasDeviceUrl) ->
|
resin.models.device.hasDeviceUrl(params.uuid).then (hasDeviceUrl) ->
|
||||||
console.log(hasDeviceUrl)
|
console.log(hasDeviceUrl)
|
||||||
@ -320,6 +330,7 @@ exports.rename =
|
|||||||
'''
|
'''
|
||||||
permission: 'user'
|
permission: 'user'
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
|
normalizeUuidProp(params)
|
||||||
Promise = require('bluebird')
|
Promise = require('bluebird')
|
||||||
resin = require('resin-sdk-preconfigured')
|
resin = require('resin-sdk-preconfigured')
|
||||||
form = require('resin-cli-form')
|
form = require('resin-cli-form')
|
||||||
@ -350,6 +361,7 @@ exports.move =
|
|||||||
permission: 'user'
|
permission: 'user'
|
||||||
options: [ commandOptions.optionalApplication ]
|
options: [ commandOptions.optionalApplication ]
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
|
normalizeUuidProp(params)
|
||||||
resin = require('resin-sdk-preconfigured')
|
resin = require('resin-sdk-preconfigured')
|
||||||
patterns = require('../utils/patterns')
|
patterns = require('../utils/patterns')
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ limitations under the License.
|
|||||||
###
|
###
|
||||||
|
|
||||||
commandOptions = require('./command-options')
|
commandOptions = require('./command-options')
|
||||||
|
{ normalizeUuidProp } = require('../utils/normalization')
|
||||||
|
|
||||||
exports.list =
|
exports.list =
|
||||||
signature: 'envs'
|
signature: 'envs'
|
||||||
@ -46,6 +47,7 @@ exports.list =
|
|||||||
]
|
]
|
||||||
permission: 'user'
|
permission: 'user'
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
|
normalizeUuidProp(options, 'device')
|
||||||
Promise = require('bluebird')
|
Promise = require('bluebird')
|
||||||
_ = require('lodash')
|
_ = require('lodash')
|
||||||
resin = require('resin-sdk-preconfigured')
|
resin = require('resin-sdk-preconfigured')
|
||||||
@ -135,6 +137,7 @@ exports.add =
|
|||||||
]
|
]
|
||||||
permission: 'user'
|
permission: 'user'
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
|
normalizeUuidProp(options, 'device')
|
||||||
Promise = require('bluebird')
|
Promise = require('bluebird')
|
||||||
resin = require('resin-sdk-preconfigured')
|
resin = require('resin-sdk-preconfigured')
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
###
|
###
|
||||||
|
|
||||||
|
{ normalizeUuidProp } = require('../utils/normalization')
|
||||||
|
|
||||||
module.exports =
|
module.exports =
|
||||||
signature: 'logs <uuid>'
|
signature: 'logs <uuid>'
|
||||||
description: 'show device logs'
|
description: 'show device logs'
|
||||||
@ -44,6 +46,7 @@ module.exports =
|
|||||||
permission: 'user'
|
permission: 'user'
|
||||||
primary: true
|
primary: true
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
|
normalizeUuidProp(params)
|
||||||
resin = require('resin-sdk-preconfigured')
|
resin = require('resin-sdk-preconfigured')
|
||||||
moment = require('moment')
|
moment = require('moment')
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
###
|
###
|
||||||
|
|
||||||
|
{ normalizeUuidProp } = require('../utils/normalization')
|
||||||
|
|
||||||
exports.set =
|
exports.set =
|
||||||
signature: 'note <|note>'
|
signature: 'note <|note>'
|
||||||
description: 'set a device note'
|
description: 'set a device note'
|
||||||
@ -38,6 +40,7 @@ exports.set =
|
|||||||
]
|
]
|
||||||
permission: 'user'
|
permission: 'user'
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
|
normalizeUuidProp(options, 'device')
|
||||||
Promise = require('bluebird')
|
Promise = require('bluebird')
|
||||||
_ = require('lodash')
|
_ = require('lodash')
|
||||||
resin = require('resin-sdk-preconfigured')
|
resin = require('resin-sdk-preconfigured')
|
||||||
|
@ -16,6 +16,7 @@ limitations under the License.
|
|||||||
|
|
||||||
commandOptions = require('./command-options')
|
commandOptions = require('./command-options')
|
||||||
_ = require('lodash')
|
_ = require('lodash')
|
||||||
|
{ normalizeUuidProp } = require('../utils/normalization')
|
||||||
|
|
||||||
formatVersion = (v, isRecommended) ->
|
formatVersion = (v, isRecommended) ->
|
||||||
result = "v#{v}"
|
result = "v#{v}"
|
||||||
@ -227,6 +228,8 @@ exports.configure =
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
|
normalizeUuidProp(params)
|
||||||
|
normalizeUuidProp(options, 'device')
|
||||||
fs = require('fs')
|
fs = require('fs')
|
||||||
Promise = require('bluebird')
|
Promise = require('bluebird')
|
||||||
readFileAsync = Promise.promisify(fs.readFile)
|
readFileAsync = Promise.promisify(fs.readFile)
|
||||||
|
@ -15,6 +15,7 @@ limitations under the License.
|
|||||||
###
|
###
|
||||||
|
|
||||||
commandOptions = require('./command-options')
|
commandOptions = require('./command-options')
|
||||||
|
{ normalizeUuidProp } = require('../utils/normalization')
|
||||||
|
|
||||||
module.exports =
|
module.exports =
|
||||||
signature: 'ssh [uuid]'
|
signature: 'ssh [uuid]'
|
||||||
@ -54,6 +55,7 @@ module.exports =
|
|||||||
Only makes sense if you've configured proxy globally."
|
Only makes sense if you've configured proxy globally."
|
||||||
]
|
]
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
|
normalizeUuidProp(params)
|
||||||
child_process = require('child_process')
|
child_process = require('child_process')
|
||||||
Promise = require('bluebird')
|
Promise = require('bluebird')
|
||||||
resin = require('resin-sdk-preconfigured')
|
resin = require('resin-sdk-preconfigured')
|
||||||
|
26
lib/utils/normalization.ts
Normal file
26
lib/utils/normalization.ts
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2016-2018 Resin.io
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import _ = require('lodash');
|
||||||
|
|
||||||
|
export function normalizeUuidProp(
|
||||||
|
params: { [key: string]: any },
|
||||||
|
propName = 'uuid',
|
||||||
|
) {
|
||||||
|
if (_.isNumber(params[propName])) {
|
||||||
|
params[propName] = _.toString(params[propName]);
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "resin-cli",
|
"name": "resin-cli",
|
||||||
"version": "6.12.7",
|
"version": "6.12.8",
|
||||||
"description": "The official resin.io CLI tool",
|
"description": "The official resin.io CLI tool",
|
||||||
"main": "./build/actions/index.js",
|
"main": "./build/actions/index.js",
|
||||||
"homepage": "https://github.com/resin-io/resin-cli",
|
"homepage": "https://github.com/resin-io/resin-cli",
|
||||||
|
Loading…
Reference in New Issue
Block a user