mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-04-28 11:59:29 +00:00
refactor: extract duplicate waitForSshSnapshotBoot to shared/ssh.ts (#2783)
The waitForSshOnly function was identically duplicated in hetzner.ts and digitalocean.ts. Extract the shared logic into waitForSshSnapshotBoot() in shared/ssh.ts and replace the duplicate cloud implementations with thin wrappers that resolve module-local state before delegating. -- qa/code-quality Co-authored-by: spawn-qa-bot <qa@openrouter.ai> Co-authored-by: L <6723574+louisgv@users.noreply.github.com>
This commit is contained in:
parent
a023223a58
commit
148cc9e7ee
3 changed files with 20 additions and 20 deletions
|
|
@ -18,6 +18,7 @@ import {
|
|||
waitForSsh as sharedWaitForSsh,
|
||||
sleep,
|
||||
spawnInteractive,
|
||||
waitForSshSnapshotBoot,
|
||||
} from "../shared/ssh";
|
||||
import { ensureSshKeys, getSshFingerprint, getSshKeyOpts } from "../shared/ssh-keys";
|
||||
import {
|
||||
|
|
@ -505,16 +506,8 @@ export async function findSpawnSnapshot(agentName: string): Promise<string | nul
|
|||
// ─── SSH-Only Wait (for snapshot boots) ──────────────────────────────────────
|
||||
|
||||
export async function waitForSshOnly(ip?: string): Promise<void> {
|
||||
const serverIp = ip || _state.serverIp;
|
||||
const selectedKeys = await ensureSshKeys();
|
||||
const keyOpts = getSshKeyOpts(selectedKeys);
|
||||
await sharedWaitForSsh({
|
||||
host: serverIp,
|
||||
user: "root",
|
||||
maxAttempts: 36,
|
||||
extraSshOpts: keyOpts,
|
||||
});
|
||||
logInfo("SSH available (snapshot boot — skipping cloud-init)");
|
||||
const keyOpts = getSshKeyOpts(await ensureSshKeys());
|
||||
await waitForSshSnapshotBoot(ip ?? _state.serverIp, keyOpts);
|
||||
}
|
||||
|
||||
// ─── Provisioning ────────────────────────────────────────────────────────────
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue