Skip to content

Commit

Permalink
restructure initialize database
Browse files Browse the repository at this point in the history
  • Loading branch information
P-T-I committed Sep 2, 2021
1 parent 6c2ce2b commit 7f86aef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
6 changes: 3 additions & 3 deletions CveXplore/cli_cmds/db_cmds/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def update_cmd(ctx):
ctx.obj["data_source"].database.update()


@db_cmd.group("populate", invoke_without_command=True, help="Populate the database")
@db_cmd.group("initialize", invoke_without_command=True, help="Initialize the database")
@click.pass_context
def populate_cmd(ctx):
ctx.obj["data_source"].database.populate()
def initialize_cmd(ctx):
ctx.obj["data_source"].database.initialize()
14 changes: 6 additions & 8 deletions CveXplore/database/maintenance/main_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,12 @@ def update(self):

self.datasource.set_handlers_for_collections()

def populate(self):
def initialize(self):

for source in self.sources:
populator = source["updater"]()
populator.populate()
cpe_pop = CPEDownloads()
cpe_pop.populate()

for post in self.posts:
indexer = post["updater"]()
indexer.create_indexes()
cve_pop = CVEDownloads()
cve_pop.populate()

self.datasource.set_handlers_for_collections()
self.update()

0 comments on commit 7f86aef

Please sign in to comment.