diff --git a/src/caas.js b/src/caas.js index 6e0a2a65f..013823bc5 100644 --- a/src/caas.js +++ b/src/caas.js @@ -2,7 +2,6 @@ exports = module.exports = { verifySetupToken: verifySetupToken, - setupDone: setupDone, backupDone: backupDone, @@ -61,27 +60,6 @@ function verifySetupToken(setupToken, callback) { }); } -function setupDone(setupToken, callback) { - assert.strictEqual(typeof setupToken, 'string'); - assert.strictEqual(typeof callback, 'function'); - - settings.getCaasConfig(function (error, caasConfig) { - if (error) return callback(new CaasError(CaasError.INTERNAL_ERROR, error)); - - // Now let the api server know we got activated - superagent.post(config.apiServerOrigin() + '/api/v1/caas/boxes/' + caasConfig.boxId + '/setup/done').query({ setupToken: setupToken }) - .timeout(30 * 1000) - .end(function (error, result) { - if (error && !error.response) return callback(new CaasError(CaasError.EXTERNAL_ERROR, error.message)); - if (result.statusCode === 403) return callback(new CaasError(CaasError.INVALID_TOKEN)); - if (result.statusCode === 409) return callback(new CaasError(CaasError.BAD_STATE, 'Already setup')); - if (result.statusCode !== 201) return callback(new CaasError(CaasError.EXTERNAL_ERROR, error.message)); - - callback(null); - }); - }); -} - function backupDone(apiConfig, backupId, appBackupIds, callback) { assert.strictEqual(typeof apiConfig, 'object'); assert.strictEqual(typeof backupId, 'string'); diff --git a/src/routes/provision.js b/src/routes/provision.js index a56820013..9da6a49c8 100644 --- a/src/routes/provision.js +++ b/src/routes/provision.js @@ -111,18 +111,7 @@ function activate(req, res, next) { if (error && error.reason === ProvisionError.BAD_FIELD) return next(new HttpError(400, error.message)); if (error) return next(new HttpError(500, error)); - // only in caas case do we have to notify the api server about activation - if (config.provider() !== 'caas') return next(new HttpSuccess(201, info)); - - caas.setupDone(req.query.setupToken, function (error) { - if (error && error.reason === CaasError.BAD_STATE) return next(new HttpError(409, 'Already setup')); - if (error && error.reason === CaasError.INVALID_TOKEN) return next(new HttpError(401, 'Invalid token')); - if (error && error.reason === CaasError.EXTERNAL_ERROR) return next(new HttpError(424, error.message)); - - if (error) return next(new HttpError(500, error)); - - next(new HttpSuccess(201, info)); - }); + next(new HttpSuccess(201, info)); }); }