diff --git a/striker-ui-api/src/lib/accessModule.ts b/striker-ui-api/src/lib/accessModule.ts index 0fe44518..1432ffc3 100644 --- a/striker-ui-api/src/lib/accessModule.ts +++ b/striker-ui-api/src/lib/accessModule.ts @@ -278,7 +278,7 @@ const getAnvilData = async () => { const getFenceSpec = async () => { await subroutine('get_fence_data', { pre: ['Striker'] }); - return getData('fence_data'); + return getData('fence_data'); }; const getHostData = async () => { diff --git a/striker-ui-api/src/lib/request_handlers/fence/getFenceTemplate.ts b/striker-ui-api/src/lib/request_handlers/fence/getFenceTemplate.ts index 7a723fcd..0dfde601 100644 --- a/striker-ui-api/src/lib/request_handlers/fence/getFenceTemplate.ts +++ b/striker-ui-api/src/lib/request_handlers/fence/getFenceTemplate.ts @@ -4,10 +4,10 @@ import { getFenceSpec } from '../../accessModule'; import { stderr } from '../../shell'; export const getFenceTemplate: RequestHandler = async (request, response) => { - let rawFenceData; + let rFenceData: AnvilDataFenceHash; try { - rawFenceData = await getFenceSpec(); + rFenceData = await getFenceSpec(); } catch (subError) { stderr(`Failed to get fence device template; CAUSE: ${subError}`); @@ -16,5 +16,5 @@ export const getFenceTemplate: RequestHandler = async (request, response) => { return; } - response.status(200).send(rawFenceData); + response.status(200).send(rFenceData); }; diff --git a/striker-ui-api/src/types/GetAnvilDataFunction.d.ts b/striker-ui-api/src/types/GetAnvilDataFunction.d.ts index 93b351b5..53433c40 100644 --- a/striker-ui-api/src/types/GetAnvilDataFunction.d.ts +++ b/striker-ui-api/src/types/GetAnvilDataFunction.d.ts @@ -33,6 +33,38 @@ type AnvilDataDatabaseHash = { }; }; +type AnvilDataFenceParameterType = + | 'boolean' + | 'integer' + | 'second' + | 'select' + | 'string'; + +type AnvilDataFenceHash = { + [agent: string]: { + actions: string[]; + description: string; + parameters: { + [parameterId: string]: { + content_type: AnvilDataFenceParameterType; + default?: string; + deprecated: number; + description: string; + obsoletes: number; + options?: string[]; + replacement: string; + required: '0' | '1'; + switches: string; + unique: '0' | '1'; + }; + }; + switch: { + [switchId: string]: { name: string }; + }; + symlink?: { [agent: string]: string }; + }; +}; + type AnvilDataHostListHash = { host_uuid: { [hostUuid: string]: {