Удалён мёртвый эндпоинт /console (VNC удалён в v0.3.0)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
"""Роуты для работы с инстансами (VM/LXC) — создание, действия, удаление, статус, консоль."""
|
||||
"""Роуты для работы с инстансами (VM/LXC) — создание, действия, удаление, статус."""
|
||||
|
||||
import logging
|
||||
from typing import List
|
||||
@@ -96,7 +96,6 @@ def _provision(instance_id: int, template_id: int, node: str) -> None:
|
||||
except Exception as exc:
|
||||
logger.exception("Ошибка провижининга instance %s", instance_id)
|
||||
instance.status = models.InstanceStatus.error
|
||||
# Не возвращаем длинный trace в root_password — только краткое сообщение.
|
||||
instance.root_password = f"ERROR: {type(exc).__name__}: {exc}"
|
||||
db.commit()
|
||||
finally:
|
||||
@@ -298,23 +297,3 @@ def delete_instance(
|
||||
instance.status = models.InstanceStatus.deleted
|
||||
db.commit()
|
||||
return {"ok": True}
|
||||
|
||||
|
||||
@router.get("/{instance_id}/console")
|
||||
def instance_console(
|
||||
instance_id: int,
|
||||
db: Session = Depends(get_db),
|
||||
user: models.User = Depends(get_current_user),
|
||||
):
|
||||
"""Возвращает данные для подключения noVNC-консоли через websocket-прокси."""
|
||||
instance = db.query(models.Instance).filter(models.Instance.id == instance_id).first()
|
||||
if not instance:
|
||||
raise HTTPException(status_code=404, detail="VPS не найден")
|
||||
_ensure_owner(instance, user)
|
||||
try:
|
||||
ticket = pve.get_vnc_ticket(instance.guest_type.value, instance.vmid, instance.node)
|
||||
except Exception as exc:
|
||||
logger.warning("instance_console: vmid=%s: %s", instance.vmid, exc)
|
||||
raise HTTPException(status_code=502, detail=f"Консоль недоступна: {exc}")
|
||||
ticket["instance_id"] = instance.id
|
||||
return ticket
|
||||
|
||||
Reference in New Issue
Block a user