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: {},
},
sbin: {
'anvil-sync-shared': {},
'anvil-access-module': {},
'anvil-provision-server': {},
'anvil-sync-shared': {},
'striker-parse-os-list': {},
},
},

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

Loading…
Cancel
Save