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++) {
|
for (var i = 0; i < 40; i++) {
|
||||||
sleep(10);
|
sleep(10);
|
||||||
res = request.get(this._origin + '/api/v1/cloudron/status').end();
|
res = request.get(this._origin + '/api/v1/cloudron/status').end();
|
||||||
if (res.statusCode === 202) {
|
if (res.statusCode === 200) {
|
||||||
console.log();
|
console.log();
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
process.stdout.write('.');
|
process.stdout.write('.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(false, 'waitForBox failed');
|
||||||
};
|
};
|
||||||
|
|
||||||
Cloudron.prototype.setCredentials = function (password, accessToken) {
|
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();
|
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');
|
common.verifyResponse2(res, 'Cannot uninstall app');
|
||||||
|
|
||||||
while (true) {
|
for (var i = 0; i < 40; i++) {
|
||||||
sleep(10);
|
sleep(10);
|
||||||
process.stdout.write('.');
|
process.stdout.write('.');
|
||||||
res = request.get(this._origin + '/api/v1/apps/'+ appId).query({ access_token: this._credentials.accessToken }).retry(0).end();
|
res = request.get(this._origin + '/api/v1/apps/'+ appId).query({ access_token: this._credentials.accessToken }).retry(0).end();
|
||||||
if (res.statusCode === 404) {
|
if (res.statusCode === 404) {
|
||||||
console.log();
|
console.log();
|
||||||
break;
|
debug('App is uninstalled'.green);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
debug('App is uninstalled'.green);
|
|
||||||
|
assert(false, 'uninstallApp failed');
|
||||||
};
|
};
|
||||||
|
|
||||||
Cloudron.prototype.update = function (toVersion) {
|
Cloudron.prototype.update = function (toVersion) {
|
||||||
process.stdout.write('Trying to update');
|
process.stdout.write('Trying to update');
|
||||||
var res;
|
var res;
|
||||||
while (true) {
|
for (var i = 0; i < 40; i++) {
|
||||||
sleep(10);
|
sleep(10);
|
||||||
process.stdout.write('.');
|
process.stdout.write('.');
|
||||||
res = request.post(this._origin + '/api/v1/cloudron/update').query({ access_token: this._credentials.accessToken }).send({ password: this._credentials.password }).end();
|
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