fix status return value
This commit is contained in:
parent
6aecb30536
commit
32d7df2214
16
cloudron.js
16
cloudron.js
@ -120,12 +120,14 @@ Cloudron.prototype.waitForBox = function () {
|
||||
for (var i = 0; i < 40; i++) {
|
||||
sleep(10);
|
||||
res = request.get(this._origin + '/api/v1/cloudron/status').end();
|
||||
if (res.statusCode === 202) {
|
||||
if (res.statusCode === 200) {
|
||||
console.log();
|
||||
break;
|
||||
return;
|
||||
}
|
||||
process.stdout.write('.');
|
||||
}
|
||||
|
||||
assert(false, 'waitForBox failed');
|
||||
};
|
||||
|
||||
Cloudron.prototype.setCredentials = function (password, accessToken) {
|
||||
@ -173,22 +175,24 @@ Cloudron.prototype.uninstallApp = function (appId) {
|
||||
var res = request.post(this._origin + '/api/v1/apps/' + appId + '/uninstall').query({ access_token: this._credentials.accessToken }).send({ password: this._credentials.password }).end();
|
||||
common.verifyResponse2(res, 'Cannot uninstall app');
|
||||
|
||||
while (true) {
|
||||
for (var i = 0; i < 40; i++) {
|
||||
sleep(10);
|
||||
process.stdout.write('.');
|
||||
res = request.get(this._origin + '/api/v1/apps/'+ appId).query({ access_token: this._credentials.accessToken }).retry(0).end();
|
||||
if (res.statusCode === 404) {
|
||||
console.log();
|
||||
break;
|
||||
debug('App is uninstalled'.green);
|
||||
return;
|
||||
}
|
||||
}
|
||||
debug('App is uninstalled'.green);
|
||||
|
||||
assert(false, 'uninstallApp failed');
|
||||
};
|
||||
|
||||
Cloudron.prototype.update = function (toVersion) {
|
||||
process.stdout.write('Trying to update');
|
||||
var res;
|
||||
while (true) {
|
||||
for (var i = 0; i < 40; i++) {
|
||||
sleep(10);
|
||||
process.stdout.write('.');
|
||||
res = request.post(this._origin + '/api/v1/cloudron/update').query({ access_token: this._credentials.accessToken }).send({ password: this._credentials.password }).end();
|
||||
|
Loading…
Reference in New Issue
Block a user