cve-bin-tool icon indicating copy to clipboard operation
cve-bin-tool copied to clipboard

Reinitialise/reload database options

Open anthonyharrison opened this issue 2 years ago • 6 comments

As I have tested new data sources and schemas, I have often had to go 'behind the scences' to delete data from the cache in order to test a new feature or bug. This is the only way to get data reloaded into the data which is a shame because the data was already in the cache but there is no way of forcing a reload

I wonder if we should offer a number of new options

--initilaise which clears the cache completely including all of the files from OSV, Redhat and GitLab

--reload which forces a reload of the data in the cache

Thoughts?

anthonyharrison avatar Feb 10 '23 09:02 anthonyharrison

These sound useful to me. We might also want to revisit how -u now works -- currently it deletes the ~/.cache/cve-bin-tool directory but maybe that's not the right choice any more, or maybe it needs to be named so that it's clear what's happening there?

terriko avatar Feb 13 '23 19:02 terriko

@terriko @anthonyharrison I would love to work on this issue but it is I found it quite unclear what these two flags would do after they are used. And as why can't we just use -u now for initilaise. And for reload if we could use function refresh_cache_and_update_db after deleting the cache using clear_cached_data which is used in -u now as well.

Rexbeast2 avatar Mar 06 '23 19:03 Rexbeast2

@Rexbeast2 The -u now command reloads the database from the sources.

The reload option was to reload the data from the cached data stored locally on disc without going to the original data sources to get the data.; the initialise option was to just delete all of the data stored locally in the cache which would them force a complete reload of the data from the original sources.

I suspect that most of the functionality already exists in the CVEDB module; it will just be a case of calling the routines in a particular order to get the desired effect. The one area to be careful with will be the time of the latest database update when doing the reload option - if we are just updating the data from the cache, the cache will not necessarily be up to date and if we set the database time to 'now' we will potentially miss some updates (maybe need to preseve the database time?)

anthonyharrison avatar Mar 06 '23 20:03 anthonyharrison

@anthonyharrison I think we can break this issue into 2 sub-parts one of which would be getting a flag for initialize option which deletes all data stored. And the other would be reloading. I will get started working with initialize one first.

Rexbeast2 avatar Mar 06 '23 21:03 Rexbeast2

@anthonyharrison just to verify in reload feature do we have to reload the database by removing the old cache and storing the current cache in it? or do we have to remove the current cache and store the backup cache in it?

Rexbeast2 avatar Mar 07 '23 20:03 Rexbeast2

@terriko I am taking this issue

AryanBakliwal avatar Apr 18 '25 12:04 AryanBakliwal