Skip to content

Commit

Permalink
fixes #260
Browse files Browse the repository at this point in the history
  • Loading branch information
P-T-I committed Feb 16, 2024
1 parent 47a24b8 commit c22242e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CveXplore/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.23
0.3.23.dev1
9 changes: 5 additions & 4 deletions CveXplore/core/database_maintenance/main_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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..."
)
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion CveXplore/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit c22242e

Please sign in to comment.