fix(striker-ui-api): correct os and driver_iso fields when registering provision server job

main
Tsu-ba-me 3 years ago
parent d8cbf63fb7
commit b553e880c9
  1. 3
      striker-ui-api/src/lib/consts/SERVER_PATHS.ts
  2. 51
      striker-ui-api/src/lib/request_handlers/server/createServer.ts

@ -11,8 +11,9 @@ const EMPTY_SERVER_PATHS: ServerPath = {
sed: {}, sed: {},
}, },
sbin: { sbin: {
'anvil-sync-shared': {},
'anvil-access-module': {}, 'anvil-access-module': {},
'anvil-provision-server': {},
'anvil-sync-shared': {},
'striker-parse-os-list': {}, 'striker-parse-os-list': {},
}, },
}, },

@ -1,6 +1,6 @@
import { RequestHandler } from 'express'; import { RequestHandler } from 'express';
// import SERVER_PATHS from '../../consts/SERVER_PATHS'; import SERVER_PATHS from '../../consts/SERVER_PATHS';
import { dbQuery, sub } from '../../accessModule'; import { dbQuery, sub } from '../../accessModule';
@ -12,24 +12,25 @@ export const createServer: RequestHandler = ({ body }, response) => {
serverName, serverName,
cpuCores, cpuCores,
memory, memory,
virtualDisks: [{ storageSize, storageGroupUUID }], virtualDisks: [
{ storageSize = undefined, storageGroupUUID = undefined } = {},
] = [],
installISOFileUUID, installISOFileUUID,
driverISOFileUUIDs, driverISOFileUUID = 'none',
anvilUUID, anvilUUID,
optimizeForOS, optimizeForOS,
} = body; } = body;
console.dir(body, { depth: null }); console.dir(body, { depth: null });
const provisionServerJobData = ` const provisionServerJobData = `server_name=${serverName}
server_name=${serverName} os=${optimizeForOS}
os=${optimizeForOS} cpu_cores=${cpuCores}
cpu_cores=${cpuCores} ram=${memory}
ram=${memory} storage_group_uuid=${storageGroupUUID}
storage_group_uuid=${storageGroupUUID} storage_size=${storageSize}
storage_size=${storageSize} install_iso=${installISOFileUUID}
install_iso=${installISOFileUUID} driver_iso=${driverISOFileUUID}`;
driver_iso=${driverISOFileUUIDs}`;
console.log(`provisionServerJobData: [${provisionServerJobData}]`); console.log(`provisionServerJobData: [${provisionServerJobData}]`);
@ -58,19 +59,19 @@ export const createServer: RequestHandler = ({ body }, response) => {
`provisionServerJobHostUUID from DB: [${provisionServerJobHostUUID}]`, `provisionServerJobHostUUID from DB: [${provisionServerJobHostUUID}]`,
); );
// sub('insert_or_update_jobs', { sub('insert_or_update_jobs', {
// subParams: { subParams: {
// file: __filename, file: __filename,
// line: 0, line: 0,
// job_command: SERVER_PATHS.usr.sbin['anvil-provision-server'].self, job_command: SERVER_PATHS.usr.sbin['anvil-provision-server'].self,
// job_data: provisionServerJobData, job_data: provisionServerJobData,
// job_name: 'server:provision', job_name: 'server:provision',
// job_title: 'job_0147', job_title: 'job_0147',
// job_description: 'job_0148', job_description: 'job_0148',
// job_progress: 0, job_progress: 0,
// job_host_uuid: provisionServerJobHostUUID, job_host_uuid: provisionServerJobHostUUID,
// }, },
// }); });
} }
response.status(202).send(); response.status(202).send();

Loading…
Cancel
Save