From c4232916f92de8295984eede63ce7a609902c46c Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Tue, 25 Apr 2023 22:56:00 -0400 Subject: [PATCH] fix(striker-ui-api): remove console calls --- .../anvil/buildQueryAnvilDetail.ts | 3 ++- .../file/buildQueryFileDetail.ts | 3 ++- .../lib/request_handlers/host/configStriker.ts | 16 ++++++---------- .../src/lib/request_handlers/server/getServer.ts | 3 ++- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/striker-ui-api/src/lib/request_handlers/anvil/buildQueryAnvilDetail.ts b/striker-ui-api/src/lib/request_handlers/anvil/buildQueryAnvilDetail.ts index 227d0291..a1561bd5 100644 --- a/striker-ui-api/src/lib/request_handlers/anvil/buildQueryAnvilDetail.ts +++ b/striker-ui-api/src/lib/request_handlers/anvil/buildQueryAnvilDetail.ts @@ -2,6 +2,7 @@ import NODE_AND_DR_RESERVED_MEMORY_SIZE from '../../consts/NODE_AND_DR_RESERVED_ import { OS_LIST } from '../../consts/OS_LIST'; import join from '../../join'; +import { stdoutVar } from '../../shell'; const buildQueryAnvilDetail = ({ anvilUUIDs = ['*'], @@ -19,7 +20,7 @@ const buildQueryAnvilDetail = ({ separator: ', ', }); - console.log(`condAnvilsUUID=[${condAnvilsUUID}]`); + stdoutVar({ condAnvilsUUID }); const buildHostQuery = ({ isSummary = false, diff --git a/striker-ui-api/src/lib/request_handlers/file/buildQueryFileDetail.ts b/striker-ui-api/src/lib/request_handlers/file/buildQueryFileDetail.ts index 7bb2ba50..2c36e0bf 100644 --- a/striker-ui-api/src/lib/request_handlers/file/buildQueryFileDetail.ts +++ b/striker-ui-api/src/lib/request_handlers/file/buildQueryFileDetail.ts @@ -1,4 +1,5 @@ import join from '../../join'; +import { stdoutVar } from '../../shell'; const buildQueryFileDetail = ({ fileUUIDs = ['*'], @@ -14,7 +15,7 @@ const buildQueryFileDetail = ({ separator: ', ', }); - console.log(`condFilesUUID=[${condFileUUIDs}]`); + stdoutVar({ condFileUUIDs }); return ` SELECT diff --git a/striker-ui-api/src/lib/request_handlers/host/configStriker.ts b/striker-ui-api/src/lib/request_handlers/host/configStriker.ts index 0ae24596..3e7aee72 100644 --- a/striker-ui-api/src/lib/request_handlers/host/configStriker.ts +++ b/striker-ui-api/src/lib/request_handlers/host/configStriker.ts @@ -10,6 +10,7 @@ import { import SERVER_PATHS from '../../consts/SERVER_PATHS'; import { job } from '../../accessModule'; +import { stderr, stdoutVar } from '../../shell'; const fvar = (configStepCount: number, fieldName: string) => ['form', `config_step${configStepCount}`, fieldName, 'value'].join('::'); @@ -40,8 +41,7 @@ export const configStriker: RequestHandler< undefined, InitializeStrikerForm > = ({ body }, response) => { - console.log('Begin initialize Striker.'); - console.dir(body, { depth: null }); + stdoutVar(body, 'Begin initialize Striker; body='); const { adminPassword = '', @@ -105,13 +105,11 @@ export const configStriker: RequestHandler< `Data organization prefix can only contain 1 to 5 lowercase alphanumeric characters; got [${dataOrganizationPrefix}]`, ); } catch (assertError) { - console.log( + stderr( `Failed to assert value when trying to initialize striker; CAUSE: ${assertError}.`, ); - response.status(400).send(); - - return; + return response.status(400).send(); } try { @@ -153,11 +151,9 @@ ${buildNetworkLinks(2, networkShortName, interfaces)}`; job_description: 'job_0071', }); } catch (subError) { - console.log(`Failed to queue striker initialization; CAUSE: ${subError}`); - - response.status(500).send(); + stderr(`Failed to queue striker initialization; CAUSE: ${subError}`); - return; + return response.status(500).send(); } response.status(200).send(); diff --git a/striker-ui-api/src/lib/request_handlers/server/getServer.ts b/striker-ui-api/src/lib/request_handlers/server/getServer.ts index 5aebe5b3..516e73ed 100644 --- a/striker-ui-api/src/lib/request_handlers/server/getServer.ts +++ b/striker-ui-api/src/lib/request_handlers/server/getServer.ts @@ -1,6 +1,7 @@ import buildGetRequestHandler from '../buildGetRequestHandler'; import join from '../../join'; import { sanitize } from '../../sanitize'; +import { stdoutVar } from '../../shell'; export const getServer = buildGetRequestHandler( (request, buildQueryOptions) => { @@ -13,7 +14,7 @@ export const getServer = buildGetRequestHandler( separator: ', ', }); - console.log(`condAnvilsUUID=[${condAnvilUUIDs}]`); + stdoutVar({ condAnvilUUIDs }); if (buildQueryOptions) { buildQueryOptions.afterQueryReturn = (queryStdout) => {