Loop until box receives an update
This commit is contained in:
parent
41fc20b1a5
commit
6b7f9e5b9a
13
cloudron.js
13
cloudron.js
@ -160,10 +160,17 @@ Cloudron.prototype.uninstallApp = function (appId) {
|
||||
}
|
||||
|
||||
Cloudron.prototype.update = function (toVersion) {
|
||||
var res = request.post(this._origin + '/api/v1/cloudron/update').query({ access_token: this._credentials.accessToken }).send({ password: this._credentials.password }).end();
|
||||
verifyResponse(res, 'Could not update');
|
||||
console.log('Update started'.green);
|
||||
process.stdout.write('Trying to update');
|
||||
while (true) {
|
||||
sleep(10);
|
||||
process.stdout.write('.');
|
||||
var res = request.post(this._origin + '/api/v1/cloudron/update').query({ access_token: this._credentials.accessToken }).send({ password: this._credentials.password }).end();
|
||||
if (res.statusCode === 422) continue; // box has not seen the update yet
|
||||
verifyResponse(res, 'Could not update');
|
||||
break;
|
||||
}
|
||||
|
||||
console.log('Update started'.green);
|
||||
process.stdout.write('Waiting for update.');
|
||||
for (var i = 0; i < 40; i++) {
|
||||
sleep(10);
|
||||
|
Loading…
Reference in New Issue
Block a user