Fix update test, a 409 indicates an update is already in progress

This commit is contained in:
Johannes Zellner 2015-09-14 14:21:30 +02:00 committed by Girish Ramakrishnan
parent 0485323ffb
commit e0242d003c
1 changed files with 2 additions and 1 deletions

View File

@ -178,7 +178,7 @@ Cloudron.prototype.uninstallApp = function (appId) {
}
}
debug('App is uninstalled'.green);
}
};
Cloudron.prototype.update = function (toVersion) {
process.stdout.write('Trying to update');
@ -188,6 +188,7 @@ Cloudron.prototype.update = function (toVersion) {
process.stdout.write('.');
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
if (res.statusCode === 409) break; // update is in progress, lock was acquired
verifyResponse(res, 'Could not update');
break;
}