mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-23 15:32:22 +00:00
Merge pull request #154 from resin-io/jviotti/fix/device-await
Fix broken device await command
This commit is contained in:
commit
30f6a78282
@ -1,5 +1,7 @@
|
||||
(function() {
|
||||
var _, async, capitano, commandOptions, deviceConfig, form, htmlToText, image, inject, manager, pine, registerDevice, resin, vcs, visuals;
|
||||
var Promise, _, async, capitano, commandOptions, deviceConfig, form, htmlToText, image, inject, manager, pine, registerDevice, resin, vcs, visuals;
|
||||
|
||||
Promise = require('bluebird');
|
||||
|
||||
capitano = require('capitano');
|
||||
|
||||
@ -159,18 +161,17 @@
|
||||
if (options.interval == null) {
|
||||
options.interval = 3000;
|
||||
}
|
||||
return poll = function() {
|
||||
poll = function() {
|
||||
return resin.models.device.isOnline(params.uuid).then(function(isOnline) {
|
||||
if (isOnline) {
|
||||
console.info("Device became online: " + params.uuid);
|
||||
return;
|
||||
} else {
|
||||
console.info("Polling device network status: " + params.uuid);
|
||||
return Promise.delay(options.interval).then(poll);
|
||||
}
|
||||
return poll().nodeify(done);
|
||||
});
|
||||
};
|
||||
return poll().nodeify(done);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
Promise = require('bluebird')
|
||||
capitano = require('capitano')
|
||||
_ = require('lodash')
|
||||
async = require('async')
|
||||
@ -221,7 +222,7 @@ exports.await =
|
||||
else
|
||||
console.info("Polling device network status: #{params.uuid}")
|
||||
return Promise.delay(options.interval).then(poll)
|
||||
poll().nodeify(done)
|
||||
poll().nodeify(done)
|
||||
|
||||
exports.init =
|
||||
signature: 'device init [device]'
|
||||
|
Loading…
Reference in New Issue
Block a user