fix(striker-ui-api): simplify get local host UUID

main
Tsu-ba-me 2 years ago
parent 82fcb1e08e
commit a37e0e2b8a
  1. 8
      striker-ui-api/src/lib/accessModule.ts
  2. 6
      striker-ui-api/src/lib/request_handlers/network-interface/getNetworkInterface.ts
  3. 6
      striker-ui-api/src/lib/request_handlers/server/getServerDetail.ts

@ -122,10 +122,16 @@ const dbSubRefreshTimestamp = () =>
const dbWrite = (query: string, options?: SpawnSyncOptions) =>
execAnvilAccessModule(['--query', query, '--mode', 'write'], options);
const getLocalHostUUID = () =>
execModuleSubroutine('host_uuid', {
subModuleName: 'Get',
}).stdout;
export {
dbJobAnvilSyncShared,
dbQuery,
execModuleSubroutine as sub,
dbSubRefreshTimestamp,
dbWrite,
getLocalHostUUID,
execModuleSubroutine as sub,
};

@ -1,4 +1,4 @@
import { sub } from '../../accessModule';
import { getLocalHostUUID } from '../../accessModule';
import buildGetRequestHandler from '../buildGetRequestHandler';
@ -7,9 +7,7 @@ export const getNetworkInterface = buildGetRequestHandler(
let localHostUUID: string;
try {
localHostUUID = sub('host_uuid', {
subModuleName: 'Get',
}).stdout;
localHostUUID = getLocalHostUUID();
} catch (subError) {
console.log(`Failed to get local host UUID; CAUSE: ${subError}`);

@ -6,7 +6,7 @@ import path from 'path';
import { REP_UUID } from '../../consts/REG_EXP_PATTERNS';
import SERVER_PATHS from '../../consts/SERVER_PATHS';
import { dbQuery, sub } from '../../accessModule';
import { dbQuery, getLocalHostUUID, sub } from '../../accessModule';
import { sanitizeQS } from '../../sanitizeQS';
import { mkfifo, rm } from '../../shell';
@ -42,9 +42,7 @@ export const getServerDetail: RequestHandler = (request, response) => {
let requestHostUUID: string, serverHostUUID: string;
try {
requestHostUUID = sub('host_uuid', {
subModuleName: 'Get',
}).stdout;
requestHostUUID = getLocalHostUUID();
} catch (subError) {
console.log(`Failed to get local host UUID; CAUSE: ${subError}`);

Loading…
Cancel
Save