Skip to content

Commit

Permalink
Fix database worker args and context start
Browse files Browse the repository at this point in the history
  • Loading branch information
timopollmeier committed Nov 19, 2024
1 parent 3fc39ae commit f12698a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion greenbone/scap/cpe_match/worker/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions greenbone/scap/generic_cli/worker/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
DEFAULT_POSTGRES_DATABASE_NAME,
DEFAULT_POSTGRES_HOST,
DEFAULT_POSTGRES_PORT,
DEFAULT_VERBOSITY,
CLIError,
)
from ...db import PostgresDatabase
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit f12698a

Please sign in to comment.