mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-22 06:57:48 +00:00
Check that the passed application exists before asking to choose device
This commit is contained in:
parent
47e6371e2e
commit
43f0288c6c
@ -188,6 +188,11 @@
|
||||
return vcs.getApplicationName(process.cwd(), callback);
|
||||
}, function(applicationName, callback) {
|
||||
options.application = applicationName;
|
||||
return resin.models.application.has(options.application, callback);
|
||||
}, function(hasApplication, callback) {
|
||||
if (!hasApplication) {
|
||||
return callback(new Error("Invalid application: " + options.application));
|
||||
}
|
||||
if (params.device != null) {
|
||||
return callback(null, params.device);
|
||||
}
|
||||
|
@ -265,6 +265,12 @@ exports.init =
|
||||
|
||||
(applicationName, callback) ->
|
||||
options.application = applicationName
|
||||
resin.models.application.has(options.application, callback)
|
||||
|
||||
(hasApplication, callback) ->
|
||||
if not hasApplication
|
||||
return callback(new Error("Invalid application: #{options.application}"))
|
||||
|
||||
return callback(null, params.device) if params.device?
|
||||
visuals.patterns.selectDrive(callback)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user