From 2db17c9d1b27ee52d5a8a27b66698d6c169854b0 Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Thu, 22 Jun 2023 03:33:14 -0400 Subject: [PATCH] fix(striker-ui-api): correct config to job data, allow flexible org name in config striker --- .../request_handlers/host/configStriker.ts | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) 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 150633ec..153b8f32 100644 --- a/striker-ui-api/src/lib/request_handlers/host/configStriker.ts +++ b/striker-ui-api/src/lib/request_handlers/host/configStriker.ts @@ -79,8 +79,8 @@ const configToJobData = ( entries: [keyof FormConfigData, FormConfigData[keyof FormConfigData]][], ) => entries - .reduce((previous, [key, value]) => { - previous += `${key}=${value}\n`; + .reduce((previous, [key, { value }]) => { + previous += `${key}=${value}\\n`; return previous; }, '') @@ -96,16 +96,16 @@ export const configStriker: RequestHandler< stdoutVar(body, 'Begin initialize Striker; body='); const { - adminPassword: rAdminPassword = '', - domainName: rDomainName = '', - hostName: rHostName = '', - hostNumber: rHostNumber = 0, - dns: rDns = '', - gateway: rGateway = '', - gatewayInterface: rGatewayInterface = '', + adminPassword: rAdminPassword, + domainName: rDomainName, + hostName: rHostName, + hostNumber: rHostNumber, + dns: rDns, + gateway: rGateway, + gatewayInterface: rGatewayInterface, networks = [], - organizationName: rOrganizationName = '', - organizationPrefix: rOrganizationPrefix = '', + organizationName: rOrganizationName, + organizationPrefix: rOrganizationPrefix, } = body; const adminPassword = sanitize(rAdminPassword, 'string'); @@ -155,7 +155,7 @@ export const configStriker: RequestHandler< ); assert( - REP_PEACEFUL_STRING.test(organizationName), + organizationName.length > 0, `Data organization name cannot be empty; got [${organizationName}]`, );