diff --git a/backend/app/routers/templates.py b/backend/app/routers/templates.py index 15f0ec1..d8f30e9 100644 --- a/backend/app/routers/templates.py +++ b/backend/app/routers/templates.py @@ -30,12 +30,22 @@ def create_template( @router.get("/from-proxmox") def list_proxmox_templates(_=Depends(require_admin)): - try: vm_tpls = pve.list_vm_templates() - except: vm_tpls = [] - try: lxc_tpls = pve.list_lxc_templates() - except: lxc_tpls = [] + """Ищет VM и LXC шаблоны непосредственно на Proxmox-ноде.""" + try: + vm_tpls = pve.list_vm_templates() + except Exception as exc: + import logging + logging.getLogger(__name__).warning("Ошибка получения VM-шаблонов из Proxmox: %s", exc) + vm_tpls = [] + try: + lxc_tpls = pve.list_lxc_templates() + except Exception as exc: + import logging + logging.getLogger(__name__).warning("Ошибка получения LXC-шаблонов из Proxmox: %s", exc) + lxc_tpls = [] return {"vm_templates": vm_tpls, "lxc_templates": lxc_tpls} + @router.delete("/{template_id}") def deactivate_template( template_id: int, db: Session = Depends(get_db), _=Depends(require_admin)