From e0242d003c9cc6cbcea4e4053650ed9bbdc115e5 Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Mon, 14 Sep 2015 14:21:30 +0200 Subject: [PATCH] Fix update test, a 409 indicates an update is already in progress --- cloudron.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cloudron.js b/cloudron.js index 957395e..e3cf614 100644 --- a/cloudron.js +++ b/cloudron.js @@ -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; }