fix: restart repeat provisions and record live controller
This commit is contained in:
parent
3ff80fa10b
commit
e99135dbb5
4 changed files with 66 additions and 4 deletions
|
|
@ -157,7 +157,12 @@ async function provision(request, options = {}) {
|
|||
else fs.writeFileSync(path.join(backupDir, `${checked.unit}.previously-absent`), "\n", { mode: 0o600 });
|
||||
writeAtomic(installedUnit, unitText, 0o644);
|
||||
await run("/usr/bin/systemctl", ["daemon-reload"]);
|
||||
await run("/usr/bin/systemctl", ["enable", "--now", checked.unit]);
|
||||
if (unitBackup) {
|
||||
await run("/usr/bin/systemctl", ["enable", checked.unit]);
|
||||
await run("/usr/bin/systemctl", ["restart", checked.unit]);
|
||||
} else {
|
||||
await run("/usr/bin/systemctl", ["enable", "--now", checked.unit]);
|
||||
}
|
||||
const runtime = await getJsonWithRetry(checked.runtimeCheck.url, options.getJson, options.healthAttempts, options.healthDelayMs);
|
||||
for (const [key, expected] of Object.entries(checked.runtimeCheck.expected)) if (runtime[key] !== expected) throw new Error(`runtime_check_failed:${key}`);
|
||||
const receipt = { schema: "guanghu.architecture-provision-receipt/v1", request_id: resource.requestId, source_commit: resource.commit, target_node: "JD-FD-PRIMARY", unit: checked.unit, runtime_check: checked.runtimeCheck.url, backup: path.join("backups", resource.requestId, resource.commit), rollback: unitBackup ? "restore-previous-unit" : "remove-new-unit", result: "DEPLOYED_AND_VERIFIED", recorded_at: new Date().toISOString() };
|
||||
|
|
|
|||
Loading…
Reference in a new issue