From e6463d281a6310aa1cf7dc8130ec8269e30db134 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B8=D0=BA=D1=82=D0=BE=D1=80?= <78488229+viktor138irk@users.noreply.github.com> Date: Thu, 7 May 2026 07:58:27 +0900 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B0=D1=82=D1=87=20=D1=83=D0=B4=D0=B0?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=81=D1=82=D0=B0=D1=80=D0=BE?= =?UTF-8?q?=D0=B3=D0=BE=20=D0=B1=D0=BB=D0=BE=D0=BA=D0=B0=20=D0=BF=D0=BE?= =?UTF-8?q?=D1=80=D1=8F=D0=B4=D0=BA=D0=B0=20=D0=B7=D0=B0=D0=B3=D1=80=D1=83?= =?UTF-8?q?=D0=B7=D0=BA=D0=B8=20=D0=B1=D1=8B=D0=BB=20=D0=B4=D0=BE=D0=B1?= =?UTF-8?q?=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../patch_remove_legacy_boot_order_card.py | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 scripts/patch_remove_legacy_boot_order_card.py diff --git a/scripts/patch_remove_legacy_boot_order_card.py b/scripts/patch_remove_legacy_boot_order_card.py new file mode 100644 index 0000000..e5c67a9 --- /dev/null +++ b/scripts/patch_remove_legacy_boot_order_card.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python3 +from pathlib import Path +import re +import sys + +app_path = Path(sys.argv[1]) if len(sys.argv) > 1 else Path('/opt/virtuality/web/app.py') +app_dir = app_path.resolve().parent if app_path.exists() else Path('/opt/virtuality/web') +template_path = app_dir / 'templates' / 'vm_detail.html' +changed = [] + +if not template_path.exists(): + print(f'legacy boot order cleanup skipped: vm_detail.html not found: {template_path}') + raise SystemExit(0) + +tpl = template_path.read_text() +original = tpl + +legacy_pattern = re.compile( + r'\n\s*
\s*\n' + r'\s*
\s*\n' + r'\s*

Порядок загрузки

\s*\n' + r'\s*boot order\s*\n' + r'.*?' + r'\s*
\s*\n', + re.DOTALL, +) + +tpl, count = legacy_pattern.subn('\n', tpl) +if count: + changed.append(f'legacy select boot-order card removed: {count}') + +# Safety cleanup for any accidental duplicated plain select card without the old pill text. +plain_select_pattern = re.compile( + r'\n\s*
\s*\n' + r'\s*
\s*\n' + r'\s*

Порядок загрузки

.*?' + r'