From 59c2bba3a022e0a31d343992922d7a125b744f87 Mon Sep 17 00:00:00 2001 From: host Date: Sat, 25 Jul 2026 10:50:47 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20bare=20except=20=E2=86=92=20except=20Exception?= =?UTF-8?q?=20=D1=81=20=D0=BB=D0=BE=D0=B3=D0=B8=D1=80=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=D0=BC=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BE=D0=BA?= =?UTF-8?q?=20Proxmox=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/routers/templates.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) 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)