@ornncompute/cli 1.0.215 → 1.0.217
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/package.json
CHANGED
package/src/vm-commands.mjs
CHANGED
|
@@ -26,6 +26,7 @@ import { dirname, join } from "node:path";
|
|
|
26
26
|
import { getAuthConfigDir, loadAuthSession } from "./auth-store.mjs";
|
|
27
27
|
import { isRecoverableWaitFailure } from "./interaction-runtime.mjs";
|
|
28
28
|
import { resolvedMountPath } from "./mount-commands.mjs";
|
|
29
|
+
import { codeOf, detailOf } from "./storage-commands.mjs";
|
|
29
30
|
import {
|
|
30
31
|
isReferenceMiss,
|
|
31
32
|
listActiveDirectReservations,
|
|
@@ -757,6 +758,18 @@ function virtualMachineForNode(payload, node, interaction) {
|
|
|
757
758
|
return matches[0] ?? null;
|
|
758
759
|
}
|
|
759
760
|
|
|
761
|
+
function keyDeliveryFailure(error) {
|
|
762
|
+
const detail = detailOf(error);
|
|
763
|
+
return {
|
|
764
|
+
code: codeOf(error),
|
|
765
|
+
message:
|
|
766
|
+
typeof detail?.message === "string" && detail.message.trim()
|
|
767
|
+
? detail.message
|
|
768
|
+
: "SSH-key delivery could not be queued.",
|
|
769
|
+
retryable: typeof detail?.retryable === "boolean" ? detail.retryable : true,
|
|
770
|
+
};
|
|
771
|
+
}
|
|
772
|
+
|
|
760
773
|
function assignmentStatus(reservationId, keys, machines) {
|
|
761
774
|
return {
|
|
762
775
|
reservation_id: reservationId,
|
|
@@ -4814,6 +4827,7 @@ export async function executeSshKeyCommand(command, input, context, interaction)
|
|
|
4814
4827
|
});
|
|
4815
4828
|
}
|
|
4816
4829
|
const deliveries = new Map();
|
|
4830
|
+
const failures = new Map();
|
|
4817
4831
|
for (const machine of machines) {
|
|
4818
4832
|
const id = machineId(machine);
|
|
4819
4833
|
const requestId = `${idempotencyKey}:${id}`;
|
|
@@ -4830,9 +4844,11 @@ export async function executeSshKeyCommand(command, input, context, interaction)
|
|
|
4830
4844
|
request_id: requestId,
|
|
4831
4845
|
status: "queued",
|
|
4832
4846
|
});
|
|
4833
|
-
} catch {
|
|
4847
|
+
} catch (error) {
|
|
4848
|
+
const failure = keyDeliveryFailure(error);
|
|
4849
|
+
failures.set(failure.code ?? failure.message, failure);
|
|
4834
4850
|
deliveries.set(id, {
|
|
4835
|
-
failure_reason:
|
|
4851
|
+
failure_reason: failure.message,
|
|
4836
4852
|
packet_id: null,
|
|
4837
4853
|
request_id: requestId,
|
|
4838
4854
|
status: "failed",
|
|
@@ -4855,8 +4871,11 @@ export async function executeSshKeyCommand(command, input, context, interaction)
|
|
|
4855
4871
|
{
|
|
4856
4872
|
code: "ssh_key_delivery_partial",
|
|
4857
4873
|
message: `SSH-key delivery could not be queued for ${failed} machine${failed === 1 ? "" : "s"}.`,
|
|
4858
|
-
retryable:
|
|
4874
|
+
retryable: [...failures.values()].some((failure) => failure.retryable),
|
|
4859
4875
|
},
|
|
4876
|
+
...[...failures.values()]
|
|
4877
|
+
.filter((failure) => failure.code)
|
|
4878
|
+
.map(({ code, message, retryable }) => ({ code, message, retryable })),
|
|
4860
4879
|
]
|
|
4861
4880
|
: [],
|
|
4862
4881
|
exitCode: failed ? 4 : 0,
|
|
@@ -4872,6 +4891,7 @@ export async function executeSshKeyCommand(command, input, context, interaction)
|
|
|
4872
4891
|
presentation: {
|
|
4873
4892
|
lines: [
|
|
4874
4893
|
`SSH-key synchronization queued for ${queued} machine${queued === 1 ? "" : "s"}${failed ? `; ${failed} failed` : ""}.`,
|
|
4894
|
+
...[...failures.values()].map((failure) => failure.message),
|
|
4875
4895
|
],
|
|
4876
4896
|
next: `ornn ssh-keys assignments status ${reservationId}`,
|
|
4877
4897
|
},
|
|
@@ -121,7 +121,7 @@ var reservationPath = (id2) => `${BASE2}/${encodeURIComponent(id2)}`;
|
|
|
121
121
|
function getReservationSpecPdf(fetcher, id2, signal) {
|
|
122
122
|
return fetcher(`${reservationPath(id2)}/spec.pdf`, { method: "GET", signal });
|
|
123
123
|
}
|
|
124
|
-
function listReservations(request, input = {}, signal) {
|
|
124
|
+
async function listReservations(request, input = {}, signal) {
|
|
125
125
|
const query = new URLSearchParams();
|
|
126
126
|
for (const [key, value] of Object.entries(input)) {
|
|
127
127
|
if (value == null || value === "")
|
|
@@ -133,10 +133,14 @@ function listReservations(request, input = {}, signal) {
|
|
|
133
133
|
query.set(key, String(value));
|
|
134
134
|
}
|
|
135
135
|
const search = query.toString();
|
|
136
|
-
|
|
136
|
+
const page = await request(`${BASE2}${search ? `?${search}` : ""}`, {
|
|
137
137
|
method: "GET",
|
|
138
138
|
...signal ? { signal } : {}
|
|
139
139
|
});
|
|
140
|
+
if (input.seller && page.seller !== true) {
|
|
141
|
+
throw new Error("Booking history is temporarily unavailable. Try refreshing later.");
|
|
142
|
+
}
|
|
143
|
+
return page;
|
|
140
144
|
}
|
|
141
145
|
async function listAllReservations(request, input = {}, signal) {
|
|
142
146
|
const reservations = [];
|
|
@@ -653,7 +653,7 @@ function editCapacityTerms(request, id, termId, body2, idempotencyKey) {
|
|
|
653
653
|
// ../../packages/api-client/dist/commerce/reservations.js
|
|
654
654
|
var BASE2 = "/commerce/reservations";
|
|
655
655
|
var reservationPath = (id) => `${BASE2}/${encodeURIComponent(id)}`;
|
|
656
|
-
function listReservations(request, input = {}, signal) {
|
|
656
|
+
async function listReservations(request, input = {}, signal) {
|
|
657
657
|
const query3 = new URLSearchParams();
|
|
658
658
|
for (const [key, value] of Object.entries(input)) {
|
|
659
659
|
if (value == null || value === "")
|
|
@@ -665,10 +665,14 @@ function listReservations(request, input = {}, signal) {
|
|
|
665
665
|
query3.set(key, String(value));
|
|
666
666
|
}
|
|
667
667
|
const search = query3.toString();
|
|
668
|
-
|
|
668
|
+
const page = await request(`${BASE2}${search ? `?${search}` : ""}`, {
|
|
669
669
|
method: "GET",
|
|
670
670
|
...signal ? { signal } : {}
|
|
671
671
|
});
|
|
672
|
+
if (input.seller && page.seller !== true) {
|
|
673
|
+
throw new Error("Booking history is temporarily unavailable. Try refreshing later.");
|
|
674
|
+
}
|
|
675
|
+
return page;
|
|
672
676
|
}
|
|
673
677
|
function getReservation(request, id, signal) {
|
|
674
678
|
return request(reservationPath(id), {
|