|
|
@ -49,8 +49,10 @@ const MAP_TO_POWER_JOB_PARAMS_BUILDER: Record< |
|
|
|
job_name: 'set_power::off', |
|
|
|
job_name: 'set_power::off', |
|
|
|
job_title: 'job_0332', |
|
|
|
job_title: 'job_0332', |
|
|
|
}), |
|
|
|
}), |
|
|
|
stopserver: ({ uuid } = {}) => ({ |
|
|
|
stopserver: ({ force, uuid } = {}) => ({ |
|
|
|
job_command: `${SERVER_PATHS.usr.sbin['anvil-shutdown-server'].self} --server-uuid '${uuid}'`, |
|
|
|
job_command: `${ |
|
|
|
|
|
|
|
SERVER_PATHS.usr.sbin['anvil-shutdown-server'].self |
|
|
|
|
|
|
|
} --server-uuid '${uuid}'${force ? ' --immediate' : ''}`,
|
|
|
|
job_description: 'job_0343', |
|
|
|
job_description: 'job_0343', |
|
|
|
job_name: 'set_power::server::off', |
|
|
|
job_name: 'set_power::server::off', |
|
|
|
job_title: 'job_0342', |
|
|
|
job_title: 'job_0342', |
|
|
@ -76,8 +78,11 @@ export const buildPowerHandler: ( |
|
|
|
(task) => async (request, response) => { |
|
|
|
(task) => async (request, response) => { |
|
|
|
const { |
|
|
|
const { |
|
|
|
params: { uuid }, |
|
|
|
params: { uuid }, |
|
|
|
|
|
|
|
query: { force: rForce }, |
|
|
|
} = request; |
|
|
|
} = request; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const force = sanitize(rForce, 'boolean'); |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
if (uuid) { |
|
|
|
if (uuid) { |
|
|
|
assert( |
|
|
|
assert( |
|
|
@ -92,7 +97,7 @@ export const buildPowerHandler: ( |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
await queuePowerJob(task, { uuid }); |
|
|
|
await queuePowerJob(task, { force, uuid }); |
|
|
|
} catch (error) { |
|
|
|
} catch (error) { |
|
|
|
stderr(`Failed to ${task} ${uuid ?? LOCAL}; CAUSE: ${error}`); |
|
|
|
stderr(`Failed to ${task} ${uuid ?? LOCAL}; CAUSE: ${error}`); |
|
|
|
|
|
|
|
|
|
|
|