mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-18 02:39:49 +00:00
Check that an application exists before asking it's type. Closes #30
This commit is contained in:
parent
3d1f023ef5
commit
193cedae26
@ -31,6 +31,11 @@
|
|||||||
action: function(params, options, done) {
|
action: function(params, options, done) {
|
||||||
return async.waterfall([
|
return async.waterfall([
|
||||||
function(callback) {
|
function(callback) {
|
||||||
|
return resin.models.application.has(params.name, callback);
|
||||||
|
}, function(hasApplication, callback) {
|
||||||
|
if (hasApplication) {
|
||||||
|
return callback(new Error('You already have an application with that name!'));
|
||||||
|
}
|
||||||
if (options.type != null) {
|
if (options.type != null) {
|
||||||
return callback(null, options.type);
|
return callback(null, options.type);
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,12 @@ exports.create =
|
|||||||
async.waterfall([
|
async.waterfall([
|
||||||
|
|
||||||
(callback) ->
|
(callback) ->
|
||||||
|
resin.models.application.has(params.name, callback)
|
||||||
|
|
||||||
|
(hasApplication, callback) ->
|
||||||
|
if hasApplication
|
||||||
|
return callback(new Error('You already have an application with that name!'))
|
||||||
|
|
||||||
return callback(null, options.type) if options.type?
|
return callback(null, options.type) if options.type?
|
||||||
|
|
||||||
resin.models.device.getSupportedDeviceTypes (error, deviceTypes) ->
|
resin.models.device.getSupportedDeviceTypes (error, deviceTypes) ->
|
||||||
|
@ -63,7 +63,7 @@
|
|||||||
"president": "^1.0.0",
|
"president": "^1.0.0",
|
||||||
"progress-stream": "^0.5.0",
|
"progress-stream": "^0.5.0",
|
||||||
"resin-cli-visuals": "^0.1.0",
|
"resin-cli-visuals": "^0.1.0",
|
||||||
"resin-sdk": "^1.3.1",
|
"resin-sdk": "^1.3.2",
|
||||||
"resin-settings-client": "^1.0.0",
|
"resin-settings-client": "^1.0.0",
|
||||||
"resin-vcs": "^1.2.0",
|
"resin-vcs": "^1.2.0",
|
||||||
"tmp": "^0.0.25",
|
"tmp": "^0.0.25",
|
||||||
|
Loading…
Reference in New Issue
Block a user