From 3dee195c4b444a7982b6215d623518913a08933d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20BERSAC?= Date: Mon, 9 Dec 2024 10:23:21 +0100 Subject: [PATCH 1/3] Accept existing index on checks --- ui/temboardui/model/versions/013_alerting-index.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/temboardui/model/versions/013_alerting-index.sql b/ui/temboardui/model/versions/013_alerting-index.sql index 61e55650a..63f1f2e53 100644 --- a/ui/temboardui/model/versions/013_alerting-index.sql +++ b/ui/temboardui/model/versions/013_alerting-index.sql @@ -1,3 +1,3 @@ SET search_path TO monitoring, public; -CREATE INDEX idx_state_changes_key +CREATE INDEX IF NOT EXISTS idx_state_changes_key ON monitoring.state_changes (check_id, key, datetime DESC); From 03bfbb917e2577a43a5ff9b8552dd068189c3a55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20BERSAC?= Date: Mon, 9 Dec 2024 10:42:40 +0100 Subject: [PATCH 2/3] Support Tornado 6.4 --- CHANGELOG.md | 1 + ui/packaging/rpm/temboard.spec | 2 +- ui/setup.py | 7 +------ ui/temboardui/autossl.py | 10 +++++++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0cc8f407..2cdc5e02b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ You need manual steps when upgrading UI. - Fix running daemonized. - Raise proper error on unknown environment. - Improve alerting performance. +- Support Tornado 6.4 on RHEL9. ## 9.0.0 diff --git a/ui/packaging/rpm/temboard.spec b/ui/packaging/rpm/temboard.spec index 6dcb5790f..1b79cec0e 100644 --- a/ui/packaging/rpm/temboard.spec +++ b/ui/packaging/rpm/temboard.spec @@ -24,7 +24,7 @@ Requires: python3-flask Requires: python3-future Requires: python3-psycopg2 > 2.8 Requires: python3-setuptools -Requires: python3-tornado +Requires: python3-tornado < 6.5 %if 0%{?rhel} < 8 Requires: python36-cryptography Requires: python36-dateutil diff --git a/ui/setup.py b/ui/setup.py index 80896474e..414f757f9 100644 --- a/ui/setup.py +++ b/ui/setup.py @@ -1,6 +1,5 @@ import os -from setuptools import __version__ as setuptoolsv from setuptools import find_packages, setup # Load version number @@ -8,9 +7,6 @@ setup_path = os.path.dirname(os.path.realpath(__file__)) exec(open(os.path.join(setup_path, "temboardui", "version.py")).read()) -if setuptoolsv < "1.0": - __version__ = __version__.replace("+", ".") - install_requires = [ "cryptography", "flask", @@ -22,8 +18,7 @@ # the user or package manager to ensure psycopg2 dependency. See # documentation. "sqlalchemy>=1.3.2,<2", - # _verify_cert in SSLIOStream is removed on Tornado 6.4+ on Python 3+. - "tornado>=6.0.2,<6.4", + "tornado>=6.0.2,<6.5", "future", ] diff --git a/ui/temboardui/autossl.py b/ui/temboardui/autossl.py index a579488f8..c10e5fe81 100644 --- a/ui/temboardui/autossl.py +++ b/ui/temboardui/autossl.py @@ -139,9 +139,13 @@ def _do_ssl_handshake(self): return self.close(exc_info=True) else: self._ssl_accepting = False - if not self._verify_cert(self.socket.getpeercert()): - self.close() - return + if hasattr(self, "_verify_cert"): + # DEPRECATED: Tornado 6.3 / Python 3.8 ? + if not self._verify_cert(self.socket.getpeercert()): + self.close() + return + else: + assert ssl.HAS_SNI # From Tornado 6.4 try: self._run_ssl_connect_callback() # Tornado < 6 except AttributeError: From 870f2a9fea2b772dc899c3af848c1ac18a6106e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20BERSAC?= Date: Mon, 9 Dec 2024 10:53:01 +0100 Subject: [PATCH 3/3] e2e: Don't check memory usage on CI --- tests/test_30_dashboard.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_30_dashboard.py b/tests/test_30_dashboard.py index c99e513c6..2be6bb95f 100644 --- a/tests/test_30_dashboard.py +++ b/tests/test_30_dashboard.py @@ -1,3 +1,4 @@ +import os from time import sleep from selenium.webdriver.common.keys import Keys @@ -28,7 +29,9 @@ def test_dashboard(browser, registered_agent, ui_url): memory, percent = browser.select("#total-memory").text.split() assert "%" == percent - assert int(memory) > 1 + if os.environ.get("CI") != "true": + # It seems that CircleCI prevent proper memory stats. + assert int(memory) > 1 memory, unit = browser.select("#memory").text.split() assert unit.endswith("B")