portacode 1.4.12__py3-none-any.whl → 1.4.12.dev0__py3-none-any.whl
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.
- portacode/_version.py +2 -2
- portacode/connection/handlers/proxmox_infra.py +20 -154
- portacode/connection/terminal.py +0 -6
- {portacode-1.4.12.dist-info → portacode-1.4.12.dev0.dist-info}/METADATA +1 -1
- {portacode-1.4.12.dist-info → portacode-1.4.12.dev0.dist-info}/RECORD +9 -9
- {portacode-1.4.12.dist-info → portacode-1.4.12.dev0.dist-info}/WHEEL +1 -1
- {portacode-1.4.12.dist-info → portacode-1.4.12.dev0.dist-info}/entry_points.txt +0 -0
- {portacode-1.4.12.dist-info → portacode-1.4.12.dev0.dist-info}/licenses/LICENSE +0 -0
- {portacode-1.4.12.dist-info → portacode-1.4.12.dev0.dist-info}/top_level.txt +0 -0
portacode/_version.py
CHANGED
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '1.4.12'
|
|
32
|
-
__version_tuple__ = version_tuple = (1, 4, 12)
|
|
31
|
+
__version__ = version = '1.4.12.dev0'
|
|
32
|
+
__version_tuple__ = version_tuple = (1, 4, 12, 'dev0')
|
|
33
33
|
|
|
34
34
|
__commit_id__ = commit_id = None
|
|
@@ -59,7 +59,6 @@ def _emit_progress_event(
|
|
|
59
59
|
message: str,
|
|
60
60
|
phase: str,
|
|
61
61
|
request_id: Optional[str],
|
|
62
|
-
client_sessions: Optional[List[str]] = None,
|
|
63
62
|
details: Optional[Dict[str, Any]] = None,
|
|
64
63
|
) -> None:
|
|
65
64
|
loop = handler.context.get("event_loop")
|
|
@@ -85,8 +84,6 @@ def _emit_progress_event(
|
|
|
85
84
|
payload["request_id"] = request_id
|
|
86
85
|
if details:
|
|
87
86
|
payload["details"] = details
|
|
88
|
-
if client_sessions:
|
|
89
|
-
payload["client_sessions"] = client_sessions
|
|
90
87
|
|
|
91
88
|
future = asyncio.run_coroutine_threadsafe(handler.send_response(payload), loop)
|
|
92
89
|
future.add_done_callback(
|
|
@@ -367,40 +364,13 @@ def _build_managed_containers_summary(records: List[Dict[str, Any]]) -> Dict[str
|
|
|
367
364
|
|
|
368
365
|
|
|
369
366
|
def _get_managed_containers_summary(force: bool = False) -> Dict[str, Any]:
|
|
370
|
-
def _refresh_container_statuses(records: List[Dict[str, Any]], config: Dict[str, Any] | None) -> None:
|
|
371
|
-
if not records or not config:
|
|
372
|
-
return
|
|
373
|
-
try:
|
|
374
|
-
proxmox = _connect_proxmox(config)
|
|
375
|
-
node = _get_node_from_config(config)
|
|
376
|
-
statuses = {
|
|
377
|
-
str(ct.get("vmid")): (ct.get("status") or "unknown").lower()
|
|
378
|
-
for ct in proxmox.nodes(node).lxc.get()
|
|
379
|
-
}
|
|
380
|
-
except Exception as exc: # pragma: no cover - best effort
|
|
381
|
-
logger.debug("Failed to refresh container statuses: %s", exc)
|
|
382
|
-
return
|
|
383
|
-
for record in records:
|
|
384
|
-
vmid = record.get("vmid")
|
|
385
|
-
if vmid is None:
|
|
386
|
-
continue
|
|
387
|
-
try:
|
|
388
|
-
vmid_key = str(int(vmid))
|
|
389
|
-
except (ValueError, TypeError):
|
|
390
|
-
continue
|
|
391
|
-
status = statuses.get(vmid_key)
|
|
392
|
-
if status:
|
|
393
|
-
record["status"] = status
|
|
394
|
-
|
|
395
367
|
now = time.monotonic()
|
|
396
368
|
with _MANAGED_CONTAINERS_CACHE_LOCK:
|
|
397
369
|
cache_ts = _MANAGED_CONTAINERS_CACHE["timestamp"]
|
|
398
370
|
cached = _MANAGED_CONTAINERS_CACHE["summary"]
|
|
399
371
|
if not force and cached and now - cache_ts < _MANAGED_CONTAINERS_CACHE_TTL_S:
|
|
400
372
|
return cached
|
|
401
|
-
config = _load_config()
|
|
402
373
|
records = _load_managed_container_records()
|
|
403
|
-
_refresh_container_statuses(records, config)
|
|
404
374
|
summary = _build_managed_containers_summary(records)
|
|
405
375
|
with _MANAGED_CONTAINERS_CACHE_LOCK:
|
|
406
376
|
_MANAGED_CONTAINERS_CACHE["timestamp"] = now
|
|
@@ -593,7 +563,7 @@ def _build_container_payload(message: Dict[str, Any], config: Dict[str, Any]) ->
|
|
|
593
563
|
hostname = (message.get("hostname") or "").strip()
|
|
594
564
|
disk_gib = int(max(round(_validate_positive_number(message.get("disk_gib") or message.get("disk"), 3)), 1))
|
|
595
565
|
ram_mib = int(max(round(_validate_positive_number(message.get("ram_mib") or message.get("ram"), 2048)), 1))
|
|
596
|
-
cpus = _validate_positive_number(message.get("cpus"),
|
|
566
|
+
cpus = _validate_positive_number(message.get("cpus"), 1)
|
|
597
567
|
storage = message.get("storage") or config.get("default_storage") or ""
|
|
598
568
|
if not storage:
|
|
599
569
|
raise ValueError("Storage pool could not be determined.")
|
|
@@ -705,22 +675,15 @@ def _portacode_connect_and_read_key(vmid: int, user: str, timeout_s: int = 10) -
|
|
|
705
675
|
|
|
706
676
|
last_pub = last_priv = None
|
|
707
677
|
stable = 0
|
|
708
|
-
history: List[Dict[str, Any]] = []
|
|
709
|
-
|
|
710
|
-
process_exited = False
|
|
711
|
-
exit_out = exit_err = ""
|
|
712
678
|
while time.time() - start < timeout_s:
|
|
713
679
|
if proc.poll() is not None:
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
}
|
|
722
|
-
)
|
|
723
|
-
break
|
|
680
|
+
out, err = proc.communicate(timeout=1)
|
|
681
|
+
return {
|
|
682
|
+
"ok": False,
|
|
683
|
+
"error": "portacode connect exited before keys were created",
|
|
684
|
+
"stdout": (out or "").strip(),
|
|
685
|
+
"stderr": (err or "").strip(),
|
|
686
|
+
}
|
|
724
687
|
pub_size = file_size(pub_path)
|
|
725
688
|
priv_size = file_size(priv_path)
|
|
726
689
|
if pub_size and priv_size:
|
|
@@ -730,60 +693,21 @@ def _portacode_connect_and_read_key(vmid: int, user: str, timeout_s: int = 10) -
|
|
|
730
693
|
stable = 0
|
|
731
694
|
last_pub, last_priv = pub_size, priv_size
|
|
732
695
|
if stable >= 1:
|
|
733
|
-
history.append(
|
|
734
|
-
{
|
|
735
|
-
"timestamp_s": round(time.time() - start, 2),
|
|
736
|
-
"pub_size": pub_size,
|
|
737
|
-
"priv_size": priv_size,
|
|
738
|
-
"stable": stable,
|
|
739
|
-
}
|
|
740
|
-
)
|
|
741
696
|
break
|
|
742
|
-
history.append(
|
|
743
|
-
{
|
|
744
|
-
"timestamp_s": round(time.time() - start, 2),
|
|
745
|
-
"pub_size": pub_size,
|
|
746
|
-
"priv_size": priv_size,
|
|
747
|
-
"stable": stable,
|
|
748
|
-
}
|
|
749
|
-
)
|
|
750
697
|
time.sleep(1)
|
|
751
698
|
|
|
752
|
-
|
|
753
|
-
final_priv = file_size(priv_path)
|
|
754
|
-
if final_pub and final_priv:
|
|
755
|
-
key_res = _run_pct(vmid, f"su - {user} -c 'cat {pub_path}'")
|
|
756
|
-
if not process_exited:
|
|
757
|
-
proc.terminate()
|
|
758
|
-
try:
|
|
759
|
-
proc.wait(timeout=3)
|
|
760
|
-
except subprocess.TimeoutExpired:
|
|
761
|
-
proc.kill()
|
|
762
|
-
return {
|
|
763
|
-
"ok": True,
|
|
764
|
-
"public_key": key_res["stdout"].strip(),
|
|
765
|
-
"history": history,
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
if not process_exited:
|
|
699
|
+
if stable < 1:
|
|
769
700
|
proc.terminate()
|
|
770
701
|
try:
|
|
771
702
|
proc.wait(timeout=3)
|
|
772
703
|
except subprocess.TimeoutExpired:
|
|
773
704
|
proc.kill()
|
|
774
|
-
|
|
775
|
-
history.append(
|
|
776
|
-
{
|
|
777
|
-
"timestamp_s": round(time.time() - start, 2),
|
|
778
|
-
"status": "timeout_waiting_for_keys",
|
|
779
|
-
}
|
|
780
|
-
)
|
|
705
|
+
out, err = proc.communicate(timeout=1)
|
|
781
706
|
return {
|
|
782
707
|
"ok": False,
|
|
783
708
|
"error": "timed out waiting for portacode key files",
|
|
784
|
-
"stdout": (
|
|
785
|
-
"stderr": (
|
|
786
|
-
"history": history,
|
|
709
|
+
"stdout": (out or "").strip(),
|
|
710
|
+
"stderr": (err or "").strip(),
|
|
787
711
|
}
|
|
788
712
|
|
|
789
713
|
proc.terminate()
|
|
@@ -796,7 +720,6 @@ def _portacode_connect_and_read_key(vmid: int, user: str, timeout_s: int = 10) -
|
|
|
796
720
|
return {
|
|
797
721
|
"ok": True,
|
|
798
722
|
"public_key": key_res["stdout"].strip(),
|
|
799
|
-
"history": history,
|
|
800
723
|
}
|
|
801
724
|
|
|
802
725
|
|
|
@@ -894,19 +817,6 @@ def _bootstrap_portacode(
|
|
|
894
817
|
total_steps=total_steps,
|
|
895
818
|
)
|
|
896
819
|
if not ok:
|
|
897
|
-
details = results[-1] if results else {}
|
|
898
|
-
summary = details.get("error_summary") or details.get("stderr") or details.get("stdout") or details.get("name")
|
|
899
|
-
history = details.get("history")
|
|
900
|
-
history_snippet = ""
|
|
901
|
-
if isinstance(history, list) and history:
|
|
902
|
-
history_snippet = f" history={history[-3:]}"
|
|
903
|
-
if summary:
|
|
904
|
-
logger.warning(
|
|
905
|
-
"Portacode bootstrap failure summary=%s%s",
|
|
906
|
-
summary,
|
|
907
|
-
f" history_len={len(history)}" if history else "",
|
|
908
|
-
)
|
|
909
|
-
raise RuntimeError(f"Portacode bootstrap steps failed: {summary}{history_snippet}")
|
|
910
820
|
raise RuntimeError("Portacode bootstrap steps failed.")
|
|
911
821
|
key_step = next((entry for entry in results if entry.get("name") == "portacode_connect"), None)
|
|
912
822
|
public_key = key_step.get("public_key") if key_step else None
|
|
@@ -1031,7 +941,7 @@ def _instantiate_container(proxmox: Any, node: str, payload: Dict[str, Any]) ->
|
|
|
1031
941
|
rootfs=rootfs,
|
|
1032
942
|
memory=int(payload["ram_mib"]),
|
|
1033
943
|
swap=int(payload.get("swap_mb", 0)),
|
|
1034
|
-
cores=
|
|
944
|
+
cores=int(payload.get("cpus", 1)),
|
|
1035
945
|
cpuunits=int(payload.get("cpuunits", 256)),
|
|
1036
946
|
net0=payload["net0"],
|
|
1037
947
|
unprivileged=int(payload.get("unprivileged", 1)),
|
|
@@ -1055,8 +965,6 @@ class CreateProxmoxContainerHandler(SyncHandler):
|
|
|
1055
965
|
def execute(self, message: Dict[str, Any]) -> Dict[str, Any]:
|
|
1056
966
|
logger.info("create_proxmox_container command received")
|
|
1057
967
|
request_id = message.get("request_id")
|
|
1058
|
-
source_client_session = message.get("source_client_session")
|
|
1059
|
-
client_sessions = [source_client_session] if source_client_session else None
|
|
1060
968
|
bootstrap_user, bootstrap_password, bootstrap_ssh_key = _get_provisioning_user_info(message)
|
|
1061
969
|
bootstrap_steps = _build_bootstrap_steps(bootstrap_user, bootstrap_password, bootstrap_ssh_key)
|
|
1062
970
|
total_steps = 3 + len(bootstrap_steps) + 2
|
|
@@ -1080,7 +988,6 @@ class CreateProxmoxContainerHandler(SyncHandler):
|
|
|
1080
988
|
message=start_message,
|
|
1081
989
|
phase="lifecycle",
|
|
1082
990
|
request_id=request_id,
|
|
1083
|
-
client_sessions=client_sessions,
|
|
1084
991
|
)
|
|
1085
992
|
try:
|
|
1086
993
|
result = action()
|
|
@@ -1095,7 +1002,6 @@ class CreateProxmoxContainerHandler(SyncHandler):
|
|
|
1095
1002
|
message=f"{step_label} failed: {exc}",
|
|
1096
1003
|
phase="lifecycle",
|
|
1097
1004
|
request_id=request_id,
|
|
1098
|
-
client_sessions=client_sessions,
|
|
1099
1005
|
details={"error": str(exc)},
|
|
1100
1006
|
)
|
|
1101
1007
|
raise
|
|
@@ -1109,7 +1015,6 @@ class CreateProxmoxContainerHandler(SyncHandler):
|
|
|
1109
1015
|
message=success_message,
|
|
1110
1016
|
phase="lifecycle",
|
|
1111
1017
|
request_id=request_id,
|
|
1112
|
-
client_sessions=client_sessions,
|
|
1113
1018
|
)
|
|
1114
1019
|
current_step_index += 1
|
|
1115
1020
|
return result
|
|
@@ -1210,7 +1115,6 @@ class CreateProxmoxContainerHandler(SyncHandler):
|
|
|
1210
1115
|
message=message_text,
|
|
1211
1116
|
phase="bootstrap",
|
|
1212
1117
|
request_id=request_id,
|
|
1213
|
-
client_sessions=client_sessions,
|
|
1214
1118
|
details=details or None,
|
|
1215
1119
|
)
|
|
1216
1120
|
|
|
@@ -1226,7 +1130,7 @@ class CreateProxmoxContainerHandler(SyncHandler):
|
|
|
1226
1130
|
)
|
|
1227
1131
|
current_step_index += len(bootstrap_steps)
|
|
1228
1132
|
|
|
1229
|
-
|
|
1133
|
+
return {
|
|
1230
1134
|
"event": "proxmox_container_created",
|
|
1231
1135
|
"success": True,
|
|
1232
1136
|
"message": f"Container {vmid} is ready and Portacode key captured.",
|
|
@@ -1243,9 +1147,6 @@ class CreateProxmoxContainerHandler(SyncHandler):
|
|
|
1243
1147
|
},
|
|
1244
1148
|
"setup_steps": steps,
|
|
1245
1149
|
}
|
|
1246
|
-
if client_sessions:
|
|
1247
|
-
response["client_sessions"] = client_sessions
|
|
1248
|
-
return response
|
|
1249
1150
|
|
|
1250
1151
|
|
|
1251
1152
|
class StartPortacodeServiceHandler(SyncHandler):
|
|
@@ -1273,8 +1174,6 @@ class StartPortacodeServiceHandler(SyncHandler):
|
|
|
1273
1174
|
start_index = int(message.get("step_index", 1))
|
|
1274
1175
|
total_steps = int(message.get("total_steps", start_index + 2))
|
|
1275
1176
|
request_id = message.get("request_id")
|
|
1276
|
-
source_client_session = message.get("source_client_session")
|
|
1277
|
-
client_sessions = [source_client_session] if source_client_session else None
|
|
1278
1177
|
|
|
1279
1178
|
auth_step_name = "setup_device_authentication"
|
|
1280
1179
|
auth_label = "Setting up device authentication"
|
|
@@ -1288,7 +1187,6 @@ class StartPortacodeServiceHandler(SyncHandler):
|
|
|
1288
1187
|
message="Notifying the server of the new device…",
|
|
1289
1188
|
phase="service",
|
|
1290
1189
|
request_id=request_id,
|
|
1291
|
-
client_sessions=client_sessions,
|
|
1292
1190
|
)
|
|
1293
1191
|
_emit_progress_event(
|
|
1294
1192
|
self,
|
|
@@ -1300,7 +1198,6 @@ class StartPortacodeServiceHandler(SyncHandler):
|
|
|
1300
1198
|
message="Authentication metadata recorded.",
|
|
1301
1199
|
phase="service",
|
|
1302
1200
|
request_id=request_id,
|
|
1303
|
-
client_sessions=client_sessions,
|
|
1304
1201
|
)
|
|
1305
1202
|
|
|
1306
1203
|
install_step = start_index + 1
|
|
@@ -1315,7 +1212,6 @@ class StartPortacodeServiceHandler(SyncHandler):
|
|
|
1315
1212
|
message="Running sudo portacode service install…",
|
|
1316
1213
|
phase="service",
|
|
1317
1214
|
request_id=request_id,
|
|
1318
|
-
client_sessions=client_sessions,
|
|
1319
1215
|
)
|
|
1320
1216
|
|
|
1321
1217
|
cmd = f"su - {user} -c 'sudo -S portacode service install'"
|
|
@@ -1332,7 +1228,6 @@ class StartPortacodeServiceHandler(SyncHandler):
|
|
|
1332
1228
|
message=f"{install_label} failed: {res.get('stderr') or res.get('stdout')}",
|
|
1333
1229
|
phase="service",
|
|
1334
1230
|
request_id=request_id,
|
|
1335
|
-
client_sessions=client_sessions,
|
|
1336
1231
|
details={
|
|
1337
1232
|
"stderr": res.get("stderr"),
|
|
1338
1233
|
"stdout": res.get("stdout"),
|
|
@@ -1350,18 +1245,14 @@ class StartPortacodeServiceHandler(SyncHandler):
|
|
|
1350
1245
|
message="Portacode service install finished.",
|
|
1351
1246
|
phase="service",
|
|
1352
1247
|
request_id=request_id,
|
|
1353
|
-
client_sessions=client_sessions,
|
|
1354
1248
|
)
|
|
1355
1249
|
|
|
1356
|
-
|
|
1250
|
+
return {
|
|
1357
1251
|
"event": "proxmox_service_started",
|
|
1358
1252
|
"success": True,
|
|
1359
1253
|
"message": "Portacode service install completed",
|
|
1360
1254
|
"ctid": str(vmid),
|
|
1361
1255
|
}
|
|
1362
|
-
if client_sessions:
|
|
1363
|
-
response["client_sessions"] = client_sessions
|
|
1364
|
-
return response
|
|
1365
1256
|
|
|
1366
1257
|
|
|
1367
1258
|
class StartProxmoxContainerHandler(SyncHandler):
|
|
@@ -1377,14 +1268,12 @@ class StartProxmoxContainerHandler(SyncHandler):
|
|
|
1377
1268
|
proxmox = _connect_proxmox(config)
|
|
1378
1269
|
node = _get_node_from_config(config)
|
|
1379
1270
|
_ensure_container_managed(proxmox, node, vmid)
|
|
1380
|
-
source_client_session = message.get("source_client_session")
|
|
1381
|
-
client_sessions = [source_client_session] if source_client_session else None
|
|
1382
1271
|
|
|
1383
1272
|
status, elapsed = _start_container(proxmox, node, vmid)
|
|
1384
1273
|
_update_container_record(vmid, {"status": "running"})
|
|
1385
1274
|
|
|
1386
1275
|
infra = get_infra_snapshot()
|
|
1387
|
-
|
|
1276
|
+
return {
|
|
1388
1277
|
"event": "proxmox_container_action",
|
|
1389
1278
|
"action": "start",
|
|
1390
1279
|
"success": True,
|
|
@@ -1394,9 +1283,6 @@ class StartProxmoxContainerHandler(SyncHandler):
|
|
|
1394
1283
|
"status": status.get("status"),
|
|
1395
1284
|
"infra": infra,
|
|
1396
1285
|
}
|
|
1397
|
-
if client_sessions:
|
|
1398
|
-
response["client_sessions"] = client_sessions
|
|
1399
|
-
return response
|
|
1400
1286
|
|
|
1401
1287
|
|
|
1402
1288
|
class StopProxmoxContainerHandler(SyncHandler):
|
|
@@ -1412,8 +1298,6 @@ class StopProxmoxContainerHandler(SyncHandler):
|
|
|
1412
1298
|
proxmox = _connect_proxmox(config)
|
|
1413
1299
|
node = _get_node_from_config(config)
|
|
1414
1300
|
_ensure_container_managed(proxmox, node, vmid)
|
|
1415
|
-
source_client_session = message.get("source_client_session")
|
|
1416
|
-
client_sessions = [source_client_session] if source_client_session else None
|
|
1417
1301
|
|
|
1418
1302
|
status, elapsed = _stop_container(proxmox, node, vmid)
|
|
1419
1303
|
final_status = status.get("status") or "stopped"
|
|
@@ -1425,7 +1309,7 @@ class StopProxmoxContainerHandler(SyncHandler):
|
|
|
1425
1309
|
if final_status != "running" and elapsed == 0.0
|
|
1426
1310
|
else f"Stopped container {vmid} in {elapsed:.1f}s."
|
|
1427
1311
|
)
|
|
1428
|
-
|
|
1312
|
+
return {
|
|
1429
1313
|
"event": "proxmox_container_action",
|
|
1430
1314
|
"action": "stop",
|
|
1431
1315
|
"success": True,
|
|
@@ -1435,9 +1319,6 @@ class StopProxmoxContainerHandler(SyncHandler):
|
|
|
1435
1319
|
"status": final_status,
|
|
1436
1320
|
"infra": infra,
|
|
1437
1321
|
}
|
|
1438
|
-
if client_sessions:
|
|
1439
|
-
response["client_sessions"] = client_sessions
|
|
1440
|
-
return response
|
|
1441
1322
|
|
|
1442
1323
|
|
|
1443
1324
|
class RemoveProxmoxContainerHandler(SyncHandler):
|
|
@@ -1453,15 +1334,13 @@ class RemoveProxmoxContainerHandler(SyncHandler):
|
|
|
1453
1334
|
proxmox = _connect_proxmox(config)
|
|
1454
1335
|
node = _get_node_from_config(config)
|
|
1455
1336
|
_ensure_container_managed(proxmox, node, vmid)
|
|
1456
|
-
source_client_session = message.get("source_client_session")
|
|
1457
|
-
client_sessions = [source_client_session] if source_client_session else None
|
|
1458
1337
|
|
|
1459
1338
|
stop_status, stop_elapsed = _stop_container(proxmox, node, vmid)
|
|
1460
1339
|
delete_status, delete_elapsed = _delete_container(proxmox, node, vmid)
|
|
1461
1340
|
_remove_container_record(vmid)
|
|
1462
1341
|
|
|
1463
1342
|
infra = get_infra_snapshot()
|
|
1464
|
-
|
|
1343
|
+
return {
|
|
1465
1344
|
"event": "proxmox_container_action",
|
|
1466
1345
|
"action": "remove",
|
|
1467
1346
|
"success": True,
|
|
@@ -1474,9 +1353,6 @@ class RemoveProxmoxContainerHandler(SyncHandler):
|
|
|
1474
1353
|
"status": "deleted",
|
|
1475
1354
|
"infra": infra,
|
|
1476
1355
|
}
|
|
1477
|
-
if client_sessions:
|
|
1478
|
-
response["client_sessions"] = client_sessions
|
|
1479
|
-
return response
|
|
1480
1356
|
|
|
1481
1357
|
|
|
1482
1358
|
class ConfigureProxmoxInfraHandler(SyncHandler):
|
|
@@ -1490,18 +1366,13 @@ class ConfigureProxmoxInfraHandler(SyncHandler):
|
|
|
1490
1366
|
verify_ssl = bool(message.get("verify_ssl"))
|
|
1491
1367
|
if not token_identifier or not token_value:
|
|
1492
1368
|
raise ValueError("token_identifier and token_value are required")
|
|
1493
|
-
source_client_session = message.get("source_client_session")
|
|
1494
|
-
client_sessions = [source_client_session] if source_client_session else None
|
|
1495
1369
|
snapshot = configure_infrastructure(token_identifier, token_value, verify_ssl=verify_ssl)
|
|
1496
|
-
|
|
1370
|
+
return {
|
|
1497
1371
|
"event": "proxmox_infra_configured",
|
|
1498
1372
|
"success": True,
|
|
1499
1373
|
"message": "Proxmox infrastructure configured",
|
|
1500
1374
|
"infra": snapshot,
|
|
1501
1375
|
}
|
|
1502
|
-
if client_sessions:
|
|
1503
|
-
response["client_sessions"] = client_sessions
|
|
1504
|
-
return response
|
|
1505
1376
|
|
|
1506
1377
|
|
|
1507
1378
|
class RevertProxmoxInfraHandler(SyncHandler):
|
|
@@ -1510,15 +1381,10 @@ class RevertProxmoxInfraHandler(SyncHandler):
|
|
|
1510
1381
|
return "revert_proxmox_infra"
|
|
1511
1382
|
|
|
1512
1383
|
def execute(self, message: Dict[str, Any]) -> Dict[str, Any]:
|
|
1513
|
-
source_client_session = message.get("source_client_session")
|
|
1514
|
-
client_sessions = [source_client_session] if source_client_session else None
|
|
1515
1384
|
snapshot = revert_infrastructure()
|
|
1516
|
-
|
|
1385
|
+
return {
|
|
1517
1386
|
"event": "proxmox_infra_reverted",
|
|
1518
1387
|
"success": True,
|
|
1519
1388
|
"message": "Proxmox infrastructure configuration reverted",
|
|
1520
1389
|
"infra": snapshot,
|
|
1521
1390
|
}
|
|
1522
|
-
if client_sessions:
|
|
1523
|
-
response["client_sessions"] = client_sessions
|
|
1524
|
-
return response
|
portacode/connection/terminal.py
CHANGED
|
@@ -56,9 +56,6 @@ from .handlers import (
|
|
|
56
56
|
CreateProxmoxContainerHandler,
|
|
57
57
|
RevertProxmoxInfraHandler,
|
|
58
58
|
StartPortacodeServiceHandler,
|
|
59
|
-
StartProxmoxContainerHandler,
|
|
60
|
-
StopProxmoxContainerHandler,
|
|
61
|
-
RemoveProxmoxContainerHandler,
|
|
62
59
|
)
|
|
63
60
|
from .handlers.project_aware_file_handlers import (
|
|
64
61
|
ProjectAwareFileWriteHandler,
|
|
@@ -483,9 +480,6 @@ class TerminalManager:
|
|
|
483
480
|
self._command_registry.register(ConfigureProxmoxInfraHandler)
|
|
484
481
|
self._command_registry.register(CreateProxmoxContainerHandler)
|
|
485
482
|
self._command_registry.register(StartPortacodeServiceHandler)
|
|
486
|
-
self._command_registry.register(StartProxmoxContainerHandler)
|
|
487
|
-
self._command_registry.register(StopProxmoxContainerHandler)
|
|
488
|
-
self._command_registry.register(RemoveProxmoxContainerHandler)
|
|
489
483
|
self._command_registry.register(RevertProxmoxInfraHandler)
|
|
490
484
|
self._command_registry.register(UpdatePortacodeHandler)
|
|
491
485
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
portacode/README.md,sha256=4dKtpvR8LNgZPVz37GmkQCMWIr_u25Ao63iW56s7Ke4,775
|
|
2
2
|
portacode/__init__.py,sha256=oB3sV1wXr-um-RXio73UG8E5Xx6cF2ZVJveqjNmC-vQ,1086
|
|
3
3
|
portacode/__main__.py,sha256=jmHTGC1hzmo9iKJLv-SSYe9BSIbPPZ2IOpecI03PlTs,296
|
|
4
|
-
portacode/_version.py,sha256=
|
|
4
|
+
portacode/_version.py,sha256=5exIeQXwAxVtu_nbVVxfGhZlbO5I6xDEDIBuQWTo_X4,719
|
|
5
5
|
portacode/cli.py,sha256=mGLKoZ-T2FBF7IA9wUq0zyG0X9__-A1ao7gajjcVRH8,21828
|
|
6
6
|
portacode/data.py,sha256=5-s291bv8J354myaHm1Y7CQZTZyRzMU3TGe5U4hb-FA,1591
|
|
7
7
|
portacode/keypair.py,sha256=0OO4vHDcF1XMxCDqce61xFTlFwlTcmqe5HyGsXFEt7s,5838
|
|
@@ -12,7 +12,7 @@ portacode/connection/README.md,sha256=f9rbuIEKa7cTm9C98rCiBbEtbiIXQU11esGSNhSMiJ
|
|
|
12
12
|
portacode/connection/__init__.py,sha256=atqcVGkViIEd7pRa6cP2do07RJOM0UWpbnz5zXjGktU,250
|
|
13
13
|
portacode/connection/client.py,sha256=jtLb9_YufqPkzi9t8VQH3iz_JEMisbtY6a8L9U5weiU,14181
|
|
14
14
|
portacode/connection/multiplex.py,sha256=L-TxqJ_ZEbfNEfu1cwxgJ5vUdyRzZjsMy2Kx1diiZys,5237
|
|
15
|
-
portacode/connection/terminal.py,sha256=
|
|
15
|
+
portacode/connection/terminal.py,sha256=07wxG_55JMy3yQ9TXCBldW9h43qCW3U8rv2yzGMx4FM,44757
|
|
16
16
|
portacode/connection/handlers/README.md,sha256=HsLZG1QK1JNm67HsgL6WoDg9nxzKXxwkc5fJPFJdX5g,12169
|
|
17
17
|
portacode/connection/handlers/WEBSOCKET_PROTOCOL.md,sha256=7tBYNEY8EBGAPIMT606BqeHnyMOQIZVlQYpH7me26LY,97962
|
|
18
18
|
portacode/connection/handlers/__init__.py,sha256=WSeBmi65GWFQPYt9M3E10rn0uZ_EPCJzNJOzSf2HZyw,2921
|
|
@@ -22,7 +22,7 @@ portacode/connection/handlers/diff_handlers.py,sha256=iYTIRCcpEQ03vIPKZCsMTE5aZb
|
|
|
22
22
|
portacode/connection/handlers/file_handlers.py,sha256=nAJH8nXnX07xxD28ngLpgIUzcTuRwZBNpEGEKdRqohw,39507
|
|
23
23
|
portacode/connection/handlers/project_aware_file_handlers.py,sha256=AqgMnDqX2893T2NsrvUSCwjN5VKj4Pb2TN0S_SuboOE,9803
|
|
24
24
|
portacode/connection/handlers/project_state_handlers.py,sha256=v6ZefGW9i7n1aZLq2jOGumJIjYb6aHlPI4m1jkYewm8,1686
|
|
25
|
-
portacode/connection/handlers/proxmox_infra.py,sha256
|
|
25
|
+
portacode/connection/handlers/proxmox_infra.py,sha256=-t9I2ED-jT1FBpgpgkWNRRWcgtGEitTQw5ukScFZWyk,50300
|
|
26
26
|
portacode/connection/handlers/registry.py,sha256=qXGE60sYEWg6ZtVQzFcZ5YI2XWR6lMgw4hAL9x5qR1I,6181
|
|
27
27
|
portacode/connection/handlers/session.py,sha256=uNGfiO_1B9-_yjJKkpvmbiJhIl6b-UXlT86UTfd6WYE,42219
|
|
28
28
|
portacode/connection/handlers/system_handlers.py,sha256=AKh7IbwptlLYrbSw5f-DHigvlaKHsg9lDP-lkAUm8cE,10755
|
|
@@ -64,7 +64,7 @@ portacode/utils/__init__.py,sha256=NgBlWTuNJESfIYJzP_3adI1yJQJR0XJLRpSdVNaBAN0,3
|
|
|
64
64
|
portacode/utils/diff_apply.py,sha256=4Oi7ft3VUCKmiUE4VM-OeqO7Gk6H7PF3WnN4WHXtjxI,15157
|
|
65
65
|
portacode/utils/diff_renderer.py,sha256=S76StnQ2DLfsz4Gg0m07UwPfRp8270PuzbNaQq-rmYk,13850
|
|
66
66
|
portacode/utils/ntp_clock.py,sha256=VqCnWCTehCufE43W23oB-WUdAZGeCcLxkmIOPwInYHc,2499
|
|
67
|
-
portacode-1.4.12.dist-info/licenses/LICENSE,sha256=2FGbCnUDgRYuQTkB1O1dUUpu5CVAjK1j4_p6ack9Z54,1066
|
|
67
|
+
portacode-1.4.12.dev0.dist-info/licenses/LICENSE,sha256=2FGbCnUDgRYuQTkB1O1dUUpu5CVAjK1j4_p6ack9Z54,1066
|
|
68
68
|
test_modules/README.md,sha256=Do_agkm9WhSzueXjRAkV_xEj6Emy5zB3N3VKY5Roce8,9274
|
|
69
69
|
test_modules/__init__.py,sha256=1LcbHodIHsB0g-g4NGjSn6AMuCoGbymvXPYLOb6Z7F0,53
|
|
70
70
|
test_modules/test_device_online.py,sha256=QtYq0Dq9vME8Gp2O4fGSheqVf8LUtpsSKosXXk56gGM,1654
|
|
@@ -90,8 +90,8 @@ testing_framework/core/playwright_manager.py,sha256=Tw46qwxIhOFkS48C2IWIQHHNpEe-
|
|
|
90
90
|
testing_framework/core/runner.py,sha256=j2QwNJmAxVBmJvcbVS7DgPJUKPNzqfLmt_4NNdaKmZU,19297
|
|
91
91
|
testing_framework/core/shared_cli_manager.py,sha256=BESSNtyQb7BOlaOvZmm04T8Uezjms4KCBs2MzTxvzYQ,8790
|
|
92
92
|
testing_framework/core/test_discovery.py,sha256=2FZ9fJ8Dp5dloA-fkgXoJ_gCMC_nYPBnA3Hs2xlagzM,4928
|
|
93
|
-
portacode-1.4.12.dist-info/METADATA,sha256=
|
|
94
|
-
portacode-1.4.12.dist-info/WHEEL,sha256=
|
|
95
|
-
portacode-1.4.12.dist-info/entry_points.txt,sha256=lLUUL-BM6_wwe44Xv0__5NQ1BnAz6jWjSMFvZdWW3zU,48
|
|
96
|
-
portacode-1.4.12.dist-info/top_level.txt,sha256=TGhTYUxfW8SyVZc_zGgzjzc24gGT7nSw8Qf73liVRKM,41
|
|
97
|
-
portacode-1.4.12.dist-info/RECORD,,
|
|
93
|
+
portacode-1.4.12.dev0.dist-info/METADATA,sha256=Ofq1p3psLwNSji1a0CMinTlbgiVDWQZa2D3sYLcsAzg,13051
|
|
94
|
+
portacode-1.4.12.dev0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
95
|
+
portacode-1.4.12.dev0.dist-info/entry_points.txt,sha256=lLUUL-BM6_wwe44Xv0__5NQ1BnAz6jWjSMFvZdWW3zU,48
|
|
96
|
+
portacode-1.4.12.dev0.dist-info/top_level.txt,sha256=TGhTYUxfW8SyVZc_zGgzjzc24gGT7nSw8Qf73liVRKM,41
|
|
97
|
+
portacode-1.4.12.dev0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|