diff --git a/CveXplore/VERSION b/CveXplore/VERSION index 955e2d9d7..53c254f43 100644 --- a/CveXplore/VERSION +++ b/CveXplore/VERSION @@ -1 +1 @@ -0.3.23 \ No newline at end of file +0.3.23.dev1 \ No newline at end of file diff --git a/CveXplore/core/database_maintenance/main_updater.py b/CveXplore/core/database_maintenance/main_updater.py index 20462ad7e..999358e67 100644 --- a/CveXplore/core/database_maintenance/main_updater.py +++ b/CveXplore/core/database_maintenance/main_updater.py @@ -30,13 +30,14 @@ class MainUpdater(UpdateBaseClass): The MainUpdater class is the main class for performing database database_maintenance tasks """ - def __init__(self, datasource: DatabaseConnectionBase): + def __init__(self, datasource: DatabaseConnectionBase, datasource_type: str): """ Init a new MainUpdater class """ super().__init__(logger_name=__name__) self.datasource = datasource + self.datasource_type = datasource_type self.sources = [ {"name": "cpe", "updater": CPEDownloads}, @@ -67,7 +68,7 @@ def update(self, update_source: str | list = None): start_time = time.time() if not self.do_initialize: - if self.datasource != "api" or self.datasource != "mongodb": + if self.datasource_type != "api" and self.datasource_type != "mongodb": self.logger.info( f"Upgrading database schema to latest head, if needed..." ) @@ -128,7 +129,7 @@ def populate(self, populate_source: str | list = None): self.logger.info(f"Starting Database population....") start_time = time.time() - if self.datasource != "api" or self.datasource != "mongodb": + if self.datasource_type != "api" and self.datasource_type != "mongodb": self.logger.info(f"Upgrading database schema to latest head, if needed...") self.database_migrator.db_upgrade() @@ -190,7 +191,7 @@ def initialize(self): self.do_initialize = True - if self.datasource != "api" or self.datasource != "mongodb": + if self.datasource_type != "api" and self.datasource_type != "mongodb": self.logger.info(f"Upgrading database schema to latest head, if needed...") self.database_migrator.db_upgrade() diff --git a/CveXplore/main.py b/CveXplore/main.py index d07e288b3..c96350cdd 100644 --- a/CveXplore/main.py +++ b/CveXplore/main.py @@ -160,7 +160,7 @@ def __init__(self, **kwargs): database_init_parameters=self.datasource_connection_details, ).database_connection if self.datasource_type != "api": - self.database = MainUpdater(datasource=self.datasource) + self.database = MainUpdater(datasource=self.datasource, datasource_type=self.datasource_type) self._database_mapping = database_mapping