From e5a53a7821d3b5084b2e0741d72067b0ea874cc9 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 09:37:49 +0900 Subject: [PATCH] =?UTF-8?q?Telegram=20notifier=20=D0=B1=D1=8B=D0=BB=20?= =?UTF-8?q?=D1=83=D0=B4=D0=B0=D0=BB=D1=91=D0=BD=20=D0=B8=D0=B7=20=D1=86?= =?UTF-8?q?=D0=B5=D0=BD=D1=82=D1=80=D0=B0=20=D0=B6=D1=83=D1=80=D0=BD=D0=B0?= =?UTF-8?q?=D0=BB=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/patch_logs_center.py | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/scripts/patch_logs_center.py b/scripts/patch_logs_center.py index c13439d..2494186 100644 --- a/scripts/patch_logs_center.py +++ b/scripts/patch_logs_center.py @@ -21,7 +21,6 @@ LOG_SOURCES = { "auto-update": {"title": "Auto Update", "kind": "journal", "unit": "virtuality-auto-update.service"}, "libvirtd": {"title": "libvirtd", "kind": "journal", "unit": "libvirtd.service"}, "virtlogd": {"title": "virtlogd", "kind": "journal", "unit": "virtlogd.service"}, - "telegram": {"title": "Telegram notifier", "kind": "file", "path": "/var/log/virtuality/telegram_version_bot.log"}, } @@ -76,7 +75,15 @@ if 'LOG_SOURCES = {' not in text: print('WARN: log helper marker not found, skip helper injection') changed.append('log center helpers skipped') else: - changed.append('log center helpers already present') + start = text.find('LOG_SOURCES = {') + end = text.find('\n}\n\n\ndef read_log_source', start) + if start != -1 and end != -1: + replacement = helpers.strip().split('\n\n\ndef read_log_source', 1)[0] + text = text[:start] + replacement + text[end + 3:] + changed.append('log sources refreshed without telegram') + else: + text = text.replace(' "telegram": {"title": "Telegram notifier", "kind": "file", "path": "/var/log/virtuality/telegram_version_bot.log"},\n', '') + changed.append('telegram log source removed') route = r''' @@ -127,7 +134,7 @@ sidebar_html = '''{% set path = request.url.path %} Обзор Создать VM
-
Образы
+ ISO Диски
@@ -152,25 +159,8 @@ if templates_dir.exists(): if '' not in html: html = html.replace('', ' \n', 1) changed.append(f'{path.name} panel.js attached') - if '{% include "_sidebar.html" %}' not in html and '
' not in html and '
' in html: - html = html.replace('\n
', '\n
\n {% include "_sidebar.html" %}\n
\n
', 1) - script_marker = '\n\n