mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-21 14:37:47 +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) {
|
||||
return async.waterfall([
|
||||
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) {
|
||||
return callback(null, options.type);
|
||||
}
|
||||
|
@ -37,6 +37,12 @@ exports.create =
|
||||
async.waterfall([
|
||||
|
||||
(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?
|
||||
|
||||
resin.models.device.getSupportedDeviceTypes (error, deviceTypes) ->
|
||||
|
@ -63,7 +63,7 @@
|
||||
"president": "^1.0.0",
|
||||
"progress-stream": "^0.5.0",
|
||||
"resin-cli-visuals": "^0.1.0",
|
||||
"resin-sdk": "^1.3.1",
|
||||
"resin-sdk": "^1.3.2",
|
||||
"resin-settings-client": "^1.0.0",
|
||||
"resin-vcs": "^1.2.0",
|
||||
"tmp": "^0.0.25",
|
||||
|
Loading…
Reference in New Issue
Block a user