Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --rebuild-gvmd-data command line option #1680

Merged
merged 13 commits into from
Sep 7, 2021

Conversation

timopollmeier
Copy link
Member

@timopollmeier timopollmeier commented Sep 7, 2021

What:
The new option allows forcing gvmd to rebuild the gvmd data objects
(configs, port lists and report formats) provided by the feed.

Why:
This addresses AP-1645 and AP-1646

How did you test it:
By running the command with various types given when there was either
no feed activity or while a --rebuild of the NVTs was active (to test the
"Feed locked" error).

Checklist:

The function sync_config_with_feed now checks whether a config file
has to be synced with the new function should_sync_config_from_path.

This will allow a general check if any configs need to be updated
later.
The test if a sync is necessary for a report format or port list is
moved to a separate function like it was done for configs.
The feed directories for configs, port lists and report formats
are now opened in a separate function which can later be reused
for a quick feed status check.
Setting the current user is now optional when opening the feed
directories for data objects.
Before trying to sync the data objects, check if the feed has any
updates first.
Also acquire the feed lock for updating the data objects to avoid
conflicts with manually triggered updates that are to be added.
The functions sync_configs_with_feed, sync_port_lists_with_feed and
sync_report_formats_with_feed will now return postive failure codes
if the feed directory or owner does not exist or the NVTs are missing
for configs.
The return codes of the functions try_open_configs_feed_dir,
try_open_port_lists_feed_dir, try_open_report_formats_feed_dir and
the corresponding sync_..._with_feed functions now distinguish
between missing feed directory and missing feed owner.
The functions for syncing configs, port lists and report formats now
have a `rebuild` parameter to skip the modification time check to force
a rebuild.
This option allows forcing a rebuild of the gvmd data via CLI.
Comments for REBUILD_SWITCH and the return values of should_sync_...
functions were missing.
The static headers for the sync_[...]_with_feed functions in the
manage_sql_[...].c files were missing the rebuild parameter.
@timopollmeier timopollmeier marked this pull request as ready for review September 7, 2021 09:00
@timopollmeier timopollmeier requested a review from a team as a code owner September 7, 2021 09:00
@jhelmold jhelmold merged commit ce1c9e2 into greenbone:master Sep 7, 2021
jhelmold added a commit that referenced this pull request Sep 7, 2021
 Add --rebuild-gvmd-data command line option (Backport #1680)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants