make deleteCloudron wait for cloudron to disappear

This commit is contained in:
Girish Ramakrishnan 2015-09-29 21:23:00 -07:00
parent a3f3bf6150
commit 5a2e494352
1 changed files with 16 additions and 0 deletions

View File

@ -38,6 +38,13 @@ AppStore.prototype.getCloudrons = function () {
return res.body.boxes;
};
AppStore.prototype.getCloudron = function (boxId) {
var res = request.get(this._origin + '/api/v1/cloudrons/' + boxId).query({ accessToken: this._credentials.accessToken, page: 1, per_page: 50 }).end();
if (res.statusCode === 404) return null;
common.verifyResponse(res, 'Could not query cloudron status');
return res.body.box;
};
AppStore.prototype.waitForCloudron = function (boxId) {
var creationTime = new Date();
process.stdout.write('Waiting for cloudron to come up.');
@ -87,6 +94,15 @@ AppStore.prototype.deleteCloudron = function (box) {
.send({ password: this._credentials.password })
.end();
common. verifyResponse(res, 'Could not delete cloudron');
process.stdout.write('Waiting for Cloudron to disappear.');
while (true) {
if (this.getCloudron(box.id) === null) break;
sleep(10);
process.stdout.write('.');
}
};
AppStore.prototype.getManifest = function (appId, version) {