@supacloud/admin 0.7.2 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +12 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -25207,8 +25207,8 @@ class SshTransport {
|
|
|
25207
25207
|
}
|
|
25208
25208
|
}
|
|
25209
25209
|
async ping() {
|
|
25210
|
-
const result = await this.exec("echo pong", 1e4)
|
|
25211
|
-
return result
|
|
25210
|
+
const result = await this.exec("echo pong", 1e4);
|
|
25211
|
+
return result.success && result.stdout.trim() === "pong";
|
|
25212
25212
|
}
|
|
25213
25213
|
close() {
|
|
25214
25214
|
this.pool.closeAll();
|
|
@@ -26155,7 +26155,8 @@ function buildRootUpgradeScript(request) {
|
|
|
26155
26155
|
"supacloud_attestation_verifier_available || { echo 'Pinned GitHub attestation verifier is unavailable' >&2; exit 1; }",
|
|
26156
26156
|
...componentBootstrapCommands(request),
|
|
26157
26157
|
`${envAssignments ? `env ${envAssignments} ` : ""}"$UPGRADE_RUNNER" upgrade --yes`
|
|
26158
|
-
].join(
|
|
26158
|
+
].join(`
|
|
26159
|
+
`);
|
|
26159
26160
|
}
|
|
26160
26161
|
function buildOfficialUpgradeCommand(request) {
|
|
26161
26162
|
const rootScript = buildRootUpgradeScript(request);
|
|
@@ -26315,7 +26316,7 @@ function assertSafeExecCommand(command) {
|
|
|
26315
26316
|
return trimmed;
|
|
26316
26317
|
if (trimmed === "cat /etc/os-release")
|
|
26317
26318
|
return trimmed;
|
|
26318
|
-
if (commandName === "hostname" && ["hostname", "hostname -f"].includes(trimmed))
|
|
26319
|
+
if (commandName === "hostname" && ["hostname", "hostname -f", "hostname -I"].includes(trimmed))
|
|
26319
26320
|
return trimmed;
|
|
26320
26321
|
if (commandName === "pg_isready") {
|
|
26321
26322
|
const seen = new Set;
|
|
@@ -26386,7 +26387,9 @@ Actions: ping, setup, install, upgrade, diagnose, exec, troubleshoot, container_
|
|
|
26386
26387
|
switch (action) {
|
|
26387
26388
|
case "ping": {
|
|
26388
26389
|
const ok = await ssh.ping();
|
|
26389
|
-
|
|
26390
|
+
if (!ok)
|
|
26391
|
+
throw new Error("SSH ping failed: server returned an unexpected response");
|
|
26392
|
+
text = "✅ Server reachable";
|
|
26390
26393
|
break;
|
|
26391
26394
|
}
|
|
26392
26395
|
case "setup": {
|
|
@@ -26531,6 +26534,10 @@ ${upgradeExecution.stdout.slice(-300)}${edgeBoundary}`;
|
|
|
26531
26534
|
throw new Error("'command' required");
|
|
26532
26535
|
const command = assertSafeExecCommand(args.command);
|
|
26533
26536
|
const r = await ssh.exec(command, getExecTimeoutMs(args.timeout_seconds));
|
|
26537
|
+
if (!r.success) {
|
|
26538
|
+
const diagnostic = (r.stderr || r.stdout).trim() || "no remote diagnostic";
|
|
26539
|
+
throw new Error(`Remote diagnostic command failed (exit ${r.code}): ${diagnostic.slice(-500)}`);
|
|
26540
|
+
}
|
|
26534
26541
|
text = `exit: ${r.code}
|
|
26535
26542
|
|
|
26536
26543
|
stdout:
|