Files

16 lines
814 B
TypeScript

/** File/history unit tests simulate the activation leaf. Provisioning tests cover
* the occupancy, capacity, source, and restart gates before reaching this leaf. */
export async function activateFiles(kind: 'beta' | 'campaign', id: number | string): Promise<void> {
const { stagedFileChanges, applyStagedFilesForOperation } =
await import('../../src/lib/server/fleet/staged-files.js');
const { requestRestart } = await import('../../src/lib/server/provisioning/index.js');
for (const server of new Set(
stagedFileChanges(kind, String(id))
.filter((row) => row.state === 'pending')
.map((row) => row.server)
)) {
const operation = requestRestart(server, { kind, id: String(id) });
applyStagedFilesForOperation(operation.id, server);
}
}