remove unncessary debug in routes

This commit is contained in:
Girish Ramakrishnan
2020-03-19 17:05:31 -07:00
parent 1b15d28212
commit 36f963dce8
3 changed files with 0 additions and 48 deletions

View File

@@ -133,8 +133,6 @@ function installApp(req, res, next) {
if ('overwriteDns' in req.body && typeof req.body.overwriteDns !== 'boolean') return next(new HttpError(400, 'overwriteDns must be boolean'));
debug('Installing app :%j', data);
apps.install(data, req.user, auditSource.fromRequest(req), function (error, result) {
if (error) return next(BoxError.toHttpError(error));
@@ -360,8 +358,6 @@ function repairApp(req, res, next) {
assert.strictEqual(typeof req.body, 'object');
assert.strictEqual(typeof req.params.id, 'string');
debug('Repair app id:%s', req.params.id);
const data = req.body;
if ('manifest' in data) {
@@ -385,8 +381,6 @@ function restoreApp(req, res, next) {
var data = req.body;
debug('Restore app id:%s', req.params.id);
if (!data.backupId || typeof data.backupId !== 'string') return next(new HttpError(400, 'backupId must be non-empty string'));
apps.restore(req.params.id, data.backupId, auditSource.fromRequest(req), function (error, result) {
@@ -402,8 +396,6 @@ function importApp(req, res, next) {
var data = req.body;
debug('Importing app id:%s', req.params.id);
if ('backupId' in data) { // if not provided, we import in-place
if (typeof data.backupId !== 'string') return next(new HttpError(400, 'backupId must be string'));
if (typeof data.backupFormat !== 'string') return next(new HttpError(400, 'backupFormat must be string'));
@@ -435,8 +427,6 @@ function cloneApp(req, res, next) {
var data = req.body;
debug('Clone app id:%s', req.params.id);
if (typeof data.backupId !== 'string') return next(new HttpError(400, 'backupId must be a string'));
if (typeof data.location !== 'string') return next(new HttpError(400, 'location is required'));
if (typeof data.domain !== 'string') return next(new HttpError(400, 'domain is required'));
@@ -454,8 +444,6 @@ function cloneApp(req, res, next) {
function backupApp(req, res, next) {
assert.strictEqual(typeof req.params.id, 'string');
debug('Backup app id:%s', req.params.id);
apps.backup(req.params.id, function (error, result) {
if (error) return next(BoxError.toHttpError(error));
@@ -466,8 +454,6 @@ function backupApp(req, res, next) {
function uninstallApp(req, res, next) {
assert.strictEqual(typeof req.params.id, 'string');
debug('Uninstalling app id:%s', req.params.id);
apps.uninstall(req.params.id, auditSource.fromRequest(req), function (error, result) {
if (error) return next(BoxError.toHttpError(error));
@@ -478,8 +464,6 @@ function uninstallApp(req, res, next) {
function startApp(req, res, next) {
assert.strictEqual(typeof req.params.id, 'string');
debug('Start app id:%s', req.params.id);
apps.start(req.params.id, auditSource.fromRequest(req), function (error, result) {
if (error) return next(BoxError.toHttpError(error));
@@ -490,8 +474,6 @@ function startApp(req, res, next) {
function stopApp(req, res, next) {
assert.strictEqual(typeof req.params.id, 'string');
debug('Stop app id:%s', req.params.id);
apps.stop(req.params.id, auditSource.fromRequest(req), function (error, result) {
if (error) return next(BoxError.toHttpError(error));
@@ -502,8 +484,6 @@ function stopApp(req, res, next) {
function restartApp(req, res, next) {
assert.strictEqual(typeof req.params.id, 'string');
debug('Restart app id:%s', req.params.id);
apps.restart(req.params.id, auditSource.fromRequest(req), function (error, result) {
if (error) return next(BoxError.toHttpError(error));
@@ -525,8 +505,6 @@ function updateApp(req, res, next) {
if ('skipBackup' in data && typeof data.skipBackup !== 'boolean') return next(new HttpError(400, 'skipBackup must be a boolean'));
if ('force' in data && typeof data.force !== 'boolean') return next(new HttpError(400, 'force must be a boolean'));
debug('Update app id:%s to manifest:%j', req.params.id, data.manifest);
apps.update(req.params.id, req.body, auditSource.fromRequest(req), function (error, result) {
if (error) return next(BoxError.toHttpError(error));
@@ -538,8 +516,6 @@ function updateApp(req, res, next) {
function getLogStream(req, res, next) {
assert.strictEqual(typeof req.params.id, 'string');
debug('Getting logstream of app id:%s', req.params.id);
var lines = 'lines' in req.query ? parseInt(req.query.lines, 10) : 10; // we ignore last-event-id
if (isNaN(lines)) return next(new HttpError(400, 'lines must be a valid number'));
@@ -580,8 +556,6 @@ function getLogs(req, res, next) {
var lines = 'lines' in req.query ? parseInt(req.query.lines, 10) : 10;
if (isNaN(lines)) return next(new HttpError(400, 'lines must be a number'));
debug('Getting logs of app id:%s', req.params.id);
var options = {
lines: lines,
follow: false,
@@ -626,8 +600,6 @@ function demuxStream(stream, stdin) {
function exec(req, res, next) {
assert.strictEqual(typeof req.params.id, 'string');
debug('Execing into app id:%s and cmd:%s', req.params.id, req.query.cmd);
var cmd = null;
if (req.query.cmd) {
cmd = safe.JSON.parse(req.query.cmd);
@@ -666,8 +638,6 @@ function exec(req, res, next) {
function execWebSocket(req, res, next) {
assert.strictEqual(typeof req.params.id, 'string');
debug('Execing websocket into app id:%s and cmd:%s', req.params.id, req.query.cmd);
var cmd = null;
if (req.query.cmd) {
cmd = safe.JSON.parse(req.query.cmd);
@@ -685,8 +655,6 @@ function execWebSocket(req, res, next) {
apps.exec(req.params.id, { cmd: cmd, rows: rows, columns: columns, tty: tty }, function (error, duplexStream) {
if (error) return next(BoxError.toHttpError(error));
debug('Connected to terminal');
req.clearTimeout();
res.handleUpgrade(function (ws) {
@@ -732,16 +700,12 @@ function listBackups(req, res, next) {
function uploadFile(req, res, next) {
assert.strictEqual(typeof req.params.id, 'string');
debug('uploadFile: %s %j -> %s', req.params.id, req.files, req.query.file);
if (typeof req.query.file !== 'string' || !req.query.file) return next(new HttpError(400, 'file query argument must be provided'));
if (!req.files.file) return next(new HttpError(400, 'file must be provided as multipart'));
apps.uploadFile(req.params.id, req.files.file.path, req.query.file, function (error) {
if (error) return next(BoxError.toHttpError(error));
debug('uploadFile: done');
next(new HttpSuccess(202, {}));
});
}
@@ -749,8 +713,6 @@ function uploadFile(req, res, next) {
function downloadFile(req, res, next) {
assert.strictEqual(typeof req.params.id, 'string');
debug('downloadFile: ', req.params.id, req.query.file);
if (typeof req.query.file !== 'string' || !req.query.file) return next(new HttpError(400, 'file query argument must be provided'));
apps.downloadFile(req.params.id, req.query.file, function (error, stream, info) {