From 9d9d856d9effeb5c0b1ea4c0ee1362e690f83ae8 Mon Sep 17 00:00:00 2001 From: Timo Pollmeier Date: Tue, 19 Nov 2024 10:05:42 +0100 Subject: [PATCH] Fix database worker args and context start --- greenbone/scap/cpe_match/worker/db.py | 2 +- greenbone/scap/generic_cli/worker/db.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/greenbone/scap/cpe_match/worker/db.py b/greenbone/scap/cpe_match/worker/db.py index 6045982..c8ab066 100644 --- a/greenbone/scap/cpe_match/worker/db.py +++ b/greenbone/scap/cpe_match/worker/db.py @@ -19,7 +19,7 @@ class CpeMatchDatabaseWriteWorker(ScapDatabaseWriteWorker[CPEMatchString]): _item_type_plural = CPE_MATCH_TYPE_PLURAL "Plural form of the type of items to use in log messages." - _arg_defaults = ScapDatabaseWriteWorker.arg_defaults + _arg_defaults = ScapDatabaseWriteWorker._arg_defaults "Default values for optional arguments." @classmethod diff --git a/greenbone/scap/generic_cli/worker/db.py b/greenbone/scap/generic_cli/worker/db.py index acdf6d2..168dc99 100644 --- a/greenbone/scap/generic_cli/worker/db.py +++ b/greenbone/scap/generic_cli/worker/db.py @@ -14,6 +14,7 @@ DEFAULT_POSTGRES_DATABASE_NAME, DEFAULT_POSTGRES_HOST, DEFAULT_POSTGRES_PORT, + DEFAULT_VERBOSITY, CLIError, ) from ...db import PostgresDatabase @@ -45,12 +46,16 @@ class ScapDatabaseWriteWorker(BaseScapWorker[T]): """ _item_type_plural = BaseScapWorker._item_type_plural + "Plural form of the type of items to use in log messages." + _arg_defaults = { "database_name": DEFAULT_POSTGRES_DATABASE_NAME, "database_host": DEFAULT_POSTGRES_HOST, "database_port": DEFAULT_POSTGRES_PORT, "database_schema": None, + "verbose": DEFAULT_VERBOSITY, } + "Default values for optional arguments." @classmethod def add_args_to_parser( @@ -232,6 +237,7 @@ async def _loop_start(self) -> None: async def __aenter__(self): await self._database.__aenter__() + await self._manager.__aenter__() return self async def __aexit__(self, exc_type, exc_val, exc_tb):