|
|
@ -6,8 +6,8 @@ import { |
|
|
|
REP_IPV4, |
|
|
|
REP_IPV4, |
|
|
|
REP_PEACEFUL_STRING, |
|
|
|
REP_PEACEFUL_STRING, |
|
|
|
REP_UUID, |
|
|
|
REP_UUID, |
|
|
|
} from '../../consts/REG_EXP_PATTERNS'; |
|
|
|
SERVER_PATHS, |
|
|
|
import SERVER_PATHS from '../../consts/SERVER_PATHS'; |
|
|
|
} from '../../consts'; |
|
|
|
|
|
|
|
|
|
|
|
import { job, variable } from '../../accessModule'; |
|
|
|
import { job, variable } from '../../accessModule'; |
|
|
|
import { sanitize } from '../../sanitize'; |
|
|
|
import { sanitize } from '../../sanitize'; |
|
|
@ -17,7 +17,7 @@ export const prepareHost: RequestHandler< |
|
|
|
unknown, |
|
|
|
unknown, |
|
|
|
undefined, |
|
|
|
undefined, |
|
|
|
PrepareHostRequestBody |
|
|
|
PrepareHostRequestBody |
|
|
|
> = (request, response) => { |
|
|
|
> = async (request, response) => { |
|
|
|
const { |
|
|
|
const { |
|
|
|
body: { |
|
|
|
body: { |
|
|
|
enterpriseUUID, |
|
|
|
enterpriseUUID, |
|
|
@ -106,14 +106,12 @@ export const prepareHost: RequestHandler< |
|
|
|
`Failed to assert value when trying to prepare host; CAUSE: ${assertError}`, |
|
|
|
`Failed to assert value when trying to prepare host; CAUSE: ${assertError}`, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
response.status(400).send(); |
|
|
|
return response.status(400).send(); |
|
|
|
|
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
if (isHostUUIDProvided) { |
|
|
|
if (isHostUUIDProvided) { |
|
|
|
variable({ |
|
|
|
await variable({ |
|
|
|
file: __filename, |
|
|
|
file: __filename, |
|
|
|
update_value_only: 1, |
|
|
|
update_value_only: 1, |
|
|
|
variable_name: 'system::configured', |
|
|
|
variable_name: 'system::configured', |
|
|
@ -141,9 +139,7 @@ type=${dataHostType}`, |
|
|
|
} catch (subError) { |
|
|
|
} catch (subError) { |
|
|
|
stderr(`Failed to init host; CAUSE: ${subError}`); |
|
|
|
stderr(`Failed to init host; CAUSE: ${subError}`); |
|
|
|
|
|
|
|
|
|
|
|
response.status(500).send(); |
|
|
|
return response.status(500).send(); |
|
|
|
|
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
response.status(200).send(); |
|
|
|
response.status(200).send(); |
|
|
|