From 9bb30059f966079dd796ab5d071230d395197c74 Mon Sep 17 00:00:00 2001 From: Tobias Persson Date: Fri, 26 Jul 2024 13:45:20 +0200 Subject: [PATCH] Fix a bug with providers --- src/environment_provider/environment_provider.py | 4 +++- src/environment_provider/lib/registry.py | 4 ---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/environment_provider/environment_provider.py b/src/environment_provider/environment_provider.py index bd04eb7..9dd4420 100644 --- a/src/environment_provider/environment_provider.py +++ b/src/environment_provider/environment_provider.py @@ -610,12 +610,13 @@ def _run(self) -> dict: def _configure_provider(self, provider_db: ETCDPath, provider_spec: dict, name: str): """Configure a single provider for a testrun.""" + self.logger.info("Saving provider with name %r in %r", name, provider_db) provider_model = ProviderSchema.model_validate(provider_spec) if provider_model.spec.jsontas: ruleset = json.dumps({name: provider_model.to_jsontas()}) else: ruleset = json.dumps({name: provider_model.to_external()}) - provider_db.join(name).write(ruleset) + provider_db.write(ruleset) def _configure_iut(self, provider_spec: dict): """Configure iut provider for a testrun.""" @@ -639,6 +640,7 @@ def _configure_dataset(self, datasets: list[dict]): def configure_environment_provider(self, suite_id: str): """Configure the environment provider if run as a part of the ETOS kubernetes controller.""" + self.logger.info("Running in an ETOS cluster - Configuring testrun") provider_client = Provider(self.kubernetes) testrun_client = TestRun(self.kubernetes) testrun = TestRunSchema.model_validate(testrun_client.get(f"testrun-{suite_id}").to_dict()) # type: ignore diff --git a/src/environment_provider/lib/registry.py b/src/environment_provider/lib/registry.py index 82add7f..4de2ebf 100644 --- a/src/environment_provider/lib/registry.py +++ b/src/environment_provider/lib/registry.py @@ -30,9 +30,6 @@ from .database import ETCDPath -# TODO: Providers are not registered automatically when running ETOS cluster controller - - class ProviderRegistry: """Environment provider registry.""" @@ -102,7 +99,6 @@ def get_log_area_provider(self) -> Optional[dict]: return json.loads(provider, object_pairs_hook=OrderedDict) return None - # def get_iut_provider_by_id(self, provider_id: str) -> Optional[dict]: def get_iut_provider(self) -> Optional[dict]: """Get IUT provider for testrun from the ETOS Database.