fixed syntax healthcheck
This commit is contained in:
@@ -10,7 +10,14 @@ healthRouter.get('/', async (_req, res) => {
|
||||
const missing = missingEnvVars();
|
||||
const checks = {
|
||||
config: checkValue(!missing.length, missing.length ? `missing: ${missing.join(', ')}` : 'ok'),
|
||||
commands: await checkCommands(['incus', 'zfs', 'zpool', 'restic', 'udevadm', 'dd']),
|
||||
commands: await checkCommands({
|
||||
incus: ['version'],
|
||||
zfs: ['version'],
|
||||
zpool: ['version'],
|
||||
restic: ['version'],
|
||||
udevadm: ['--version'],
|
||||
dd: ['--version'],
|
||||
}),
|
||||
zfsPool: await checkZfsPool(),
|
||||
zvol: await checkZvolAccess(),
|
||||
resticRepository: await checkResticRepository(),
|
||||
@@ -22,8 +29,8 @@ healthRouter.get('/', async (_req, res) => {
|
||||
|
||||
async function checkCommands(commands) {
|
||||
const results = {};
|
||||
await Promise.all(commands.map(async (command) => {
|
||||
results[command] = await checkCommand(command, ['--version']);
|
||||
await Promise.all(Object.entries(commands).map(async ([command, args]) => {
|
||||
results[command] = await checkCommand(command, args);
|
||||
}));
|
||||
const failed = Object.entries(results).filter(([, result]) => !result.ok);
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user