From 36e1b71771dfc52838012858036243709dc8f4b0 Mon Sep 17 00:00:00 2001 From: badrogger Date: Fri, 3 Nov 2023 16:16:09 +0000 Subject: [PATCH 1/6] Run update config monitor regardless of outdated config --- core/schains/monitor/skaled_monitor.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/core/schains/monitor/skaled_monitor.py b/core/schains/monitor/skaled_monitor.py index 7909f4a77..11e0bb4aa 100644 --- a/core/schains/monitor/skaled_monitor.py +++ b/core/schains/monitor/skaled_monitor.py @@ -233,9 +233,7 @@ def is_config_update_time( ) -> bool: if not skaled_status: return False - return not status['config_updated'] and \ - not status['skaled_container'] and \ - skaled_status.exit_time_reached + return not status['skaled_container'] and skaled_status.exit_time_reached def is_recreate_mode(schain_record: SChainRecord) -> bool: From cfe7b5515c0db572c4c5c8aea528d27d39543830 Mon Sep 17 00:00:00 2001 From: badrogger Date: Fri, 3 Nov 2023 21:30:01 +0000 Subject: [PATCH 2/6] Add test --- tests/schains/monitor/skaled_monitor_test.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/schains/monitor/skaled_monitor_test.py b/tests/schains/monitor/skaled_monitor_test.py index 57beb9e58..f5d8ee648 100644 --- a/tests/schains/monitor/skaled_monitor_test.py +++ b/tests/schains/monitor/skaled_monitor_test.py @@ -383,6 +383,7 @@ def test_get_skaled_monitor_new_node( def test_get_skaled_monitor_update_config( skaled_am, skaled_checks_outdated_config, + skaled_checks_new_config, schain_db, skaled_status_exit_time_reached, ): @@ -399,6 +400,16 @@ def test_get_skaled_monitor_update_config( ) assert mon == UpdateConfigSkaledMonitor + status = skaled_checks_new_config.get_all() + status['skaled_container'] = False + mon = get_skaled_monitor( + skaled_am, + status, + schain_record, + skaled_status_exit_time_reached + ) + assert mon == UpdateConfigSkaledMonitor + def test_get_skaled_monitor_recreate( skaled_am, From 3198acf86a54bb68959638746d188d7e06f11abf Mon Sep 17 00:00:00 2001 From: badrogger Date: Mon, 6 Nov 2023 11:30:39 +0000 Subject: [PATCH 3/6] Fix removing schain after failed dkg --- Dockerfile | 5 ++--- core/schains/checks.py | 2 +- core/schains/monitor/skaled_monitor.py | 16 +++++++++------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index a7d00e9b4..06f6a239d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,6 @@ -FROM python:3.9-buster +FROM python:3.10-bullseye -RUN apt-get update && apt-get install -y wget git libxslt-dev iptables kmod swig3.0 -RUN ln -s /usr/bin/swig3.0 /usr/bin/swig +RUN apt-get update && apt-get install -y wget git libxslt-dev iptables kmod swig RUN mkdir /usr/src/admin WORKDIR /usr/src/admin diff --git a/core/schains/checks.py b/core/schains/checks.py index cd331d591..3d45aff95 100644 --- a/core/schains/checks.py +++ b/core/schains/checks.py @@ -404,7 +404,7 @@ def get_all(self, log: bool = True, save: bool = False, needed: Optional[List[st needed=needed ) plain_checks.update(subj_checks) - if not self.estate.ima_linked: + if not self.estate or not self.estate.ima_linked: if 'ima_container' in plain_checks: del plain_checks['ima_container'] diff --git a/core/schains/monitor/skaled_monitor.py b/core/schains/monitor/skaled_monitor.py index 11e0bb4aa..63e3187cf 100644 --- a/core/schains/monitor/skaled_monitor.py +++ b/core/schains/monitor/skaled_monitor.py @@ -48,13 +48,15 @@ def execute(self) -> None: def run(self): typename = type(self).__name__ - logger.info('Skaled monitor type %s starting', typename) - self.am._upd_last_seen() - self.execute() - self.am._upd_schain_record() - self.am.log_executed_blocks() - self.am._upd_last_seen() - logger.info('Skaled monitor type %s finished', typename) + logger.info('Skaled monitor type starting %s', typename) + try: + self.am._upd_last_seen() + self.execute() + self.am._upd_schain_record() + self.am.log_executed_blocks() + self.am._upd_last_seen() + finally: + logger.info('Skaled monitor type finished %s', typename) class RegularSkaledMonitor(BaseSkaledMonitor): From 4145980f45e4b5699e8af6578be4a55b0091cc7c Mon Sep 17 00:00:00 2001 From: badrogger Date: Mon, 6 Nov 2023 11:35:59 +0000 Subject: [PATCH 4/6] Add try-finally to Config Monitor --- core/schains/monitor/config_monitor.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/core/schains/monitor/config_monitor.py b/core/schains/monitor/config_monitor.py index 7a85f2694..a5d8be3af 100644 --- a/core/schains/monitor/config_monitor.py +++ b/core/schains/monitor/config_monitor.py @@ -43,12 +43,14 @@ def execute(self) -> None: def run(self): typename = type(self).__name__ - logger.info('Config monitor type %s starting', typename) - self.am._upd_last_seen() - self.execute() - self.am.log_executed_blocks() - self.am._upd_last_seen() - logger.info('Config monitor type %s finished', typename) + logger.info('Config monitor type starting %s', typename) + try: + self.am._upd_last_seen() + self.execute() + self.am.log_executed_blocks() + self.am._upd_last_seen() + finally: + logger.info('Config monitor type finished %s', typename) class RegularConfigMonitor(BaseConfigMonitor): From 19c8f35d121c453671a7234884dfcecabcef9aae Mon Sep 17 00:00:00 2001 From: badrogger Date: Mon, 6 Nov 2023 13:36:17 +0000 Subject: [PATCH 5/6] Rollback Dockerfile --- Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 06f6a239d..a7d00e9b4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,7 @@ -FROM python:3.10-bullseye +FROM python:3.9-buster -RUN apt-get update && apt-get install -y wget git libxslt-dev iptables kmod swig +RUN apt-get update && apt-get install -y wget git libxslt-dev iptables kmod swig3.0 +RUN ln -s /usr/bin/swig3.0 /usr/bin/swig RUN mkdir /usr/src/admin WORKDIR /usr/src/admin From 755445831a1fe9c915f9e8de598bcbe434e4b110 Mon Sep 17 00:00:00 2001 From: badrogger Date: Mon, 6 Nov 2023 14:01:22 +0000 Subject: [PATCH 6/6] Bump VERSION to 2.5.3 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index f225a78ad..aedc15bb0 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.5.2 +2.5.3