Миграция оркестратора на Debian 13: platform layer, preflight, status/diagnostics и structured logging
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import { install } from "./commands/install";
|
||||
import { reconfigure } from "./commands/reconfigure";
|
||||
import { doctor } from "./commands/doctor";
|
||||
import { status } from "./commands/status";
|
||||
import { diagnosticsCollect } from "./commands/diagnostics";
|
||||
import type { InstallOptions, ReconfigureOptions } from "./types/context";
|
||||
|
||||
function usage(): never {
|
||||
@@ -8,6 +10,8 @@ function usage(): never {
|
||||
console.error(" hy2xs-orchestrator install --package-dir <path> [--config <path>] [--skip-firewall] [--skip-start] [--non-interactive]");
|
||||
console.error(" hy2xs-orchestrator reconfigure --package-dir <path> [--config <path>] [--dry-run|--apply] [--skip-firewall] [--skip-start]");
|
||||
console.error(" hy2xs-orchestrator doctor --package-dir <path> [--config <path>] [--skip-firewall] [--skip-start]");
|
||||
console.error(" hy2xs-orchestrator status --package-dir <path> [--config <path>] [--skip-firewall] [--skip-start]");
|
||||
console.error(" hy2xs-orchestrator diagnostics collect --package-dir <path> [--config <path>] [--skip-firewall] [--skip-start]");
|
||||
process.exit(2);
|
||||
}
|
||||
|
||||
@@ -118,6 +122,10 @@ function parseReconfigureOptions(args: string[]): ReconfigureOptions {
|
||||
return options;
|
||||
}
|
||||
|
||||
function parseCommonOptions(args: string[]): InstallOptions {
|
||||
return parseInstallOptions(args);
|
||||
}
|
||||
|
||||
async function main(): Promise<void> {
|
||||
const [command, ...args] = Bun.argv.slice(2);
|
||||
if (command === "install") {
|
||||
@@ -133,6 +141,18 @@ async function main(): Promise<void> {
|
||||
await doctor(options);
|
||||
return;
|
||||
}
|
||||
if (command === "status") {
|
||||
await status(parseCommonOptions(args));
|
||||
return;
|
||||
}
|
||||
if (command === "diagnostics") {
|
||||
const [subcommand, ...rest] = args;
|
||||
if (subcommand !== "collect") {
|
||||
usage();
|
||||
}
|
||||
await diagnosticsCollect(parseCommonOptions(rest));
|
||||
return;
|
||||
}
|
||||
usage();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user