Skip to content

Commit

Permalink
Merge pull request #1325 from greenbone/trash-pred-in-main
Browse files Browse the repository at this point in the history
Move "feed object in trash" checks to startup
  • Loading branch information
timopollmeier authored Oct 13, 2020
2 parents 47b3b14 + ee16527 commit 9ef78d0
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 27 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Switch result filter column 'task' from task ID to name task name [#1317](https://github.com/greenbone/gvmd/pull/1317)
- Correct check of get_certificate_info return [#1318](https://github.com/greenbone/gvmd/pull/1318)
- Fix GMP doc text of `active` elem for notes and overrides [#1323](https://github.com/greenbone/gvmd/pull/1323)
- Move feed object in trash checks to startup [#1325](https://github.com/greenbone/gvmd/pull/1325)

### Removed
- Remove DROP from vulns creation [#1281](http://github.com/greenbone/gvmd/pull/1281)
Expand Down
9 changes: 0 additions & 9 deletions src/manage_configs.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,15 +349,6 @@ sync_config_with_feed (const gchar *path)
if (find_trash_config_no_acl (uuid, &config) == 0
&& config)
{
static int warned = 0;

if (warned == 0)
{
warned = 1;
g_warning ("%s: ignoring a config ('%s'), as it is in the trashcan"
" (will not warn again)",
__func__, uuid);
}
g_free (uuid);
return;
}
Expand Down
9 changes: 0 additions & 9 deletions src/manage_port_lists.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,15 +283,6 @@ sync_port_list_with_feed (const gchar *path)
if (find_trash_port_list_no_acl (uuid, &port_list) == 0
&& port_list)
{
static int warned = 0;

if (warned == 0)
{
warned = 1;
g_warning ("%s: ignoring a port list ('%s'), as it is in the trashcan"
" (will not warn again)",
__func__, uuid);
}
g_free (uuid);
return;
}
Expand Down
9 changes: 0 additions & 9 deletions src/manage_report_formats.c
Original file line number Diff line number Diff line change
Expand Up @@ -643,15 +643,6 @@ sync_report_format_with_feed (const gchar *path)
if (find_trash_report_format_no_acl (uuid, &report_format) == 0
&& report_format)
{
static int warned = 0;

if (warned == 0)
{
warned = 1;
g_warning ("%s: ignoring a report format ('%s'), as it is in the trashcan"
" (will not warn again)",
__func__, uuid);
}
g_free (uuid);
return;
}
Expand Down
9 changes: 9 additions & 0 deletions src/manage_sql_configs.c
Original file line number Diff line number Diff line change
Expand Up @@ -4818,4 +4818,13 @@ check_db_configs ()

if (sync_configs_with_feed ())
g_warning ("%s: Failed to sync configs with feed", __func__);

/* Warn about feed resources in the trash. */
if (sql_int ("SELECT EXISTS (SELECT * FROM configs_trash"
" WHERE predefined = 1);"))
{
g_warning ("%s: There are feed configs/policies in the trash."
" These will be excluded from the sync.",
__func__);
}
}
9 changes: 9 additions & 0 deletions src/manage_sql_port_lists.c
Original file line number Diff line number Diff line change
Expand Up @@ -2607,4 +2607,13 @@ check_db_port_lists ()
* This should be a migrator, but this way is easier to backport. */
sql ("UPDATE port_ranges SET \"end\" = 65535 WHERE \"end\" = 65536;");
sql ("UPDATE port_ranges SET start = 65535 WHERE start = 65536;");

/* Warn about feed resources in the trash. */
if (sql_int ("SELECT EXISTS (SELECT * FROM port_lists_trash"
" WHERE predefined = 1);"))
{
g_warning ("%s: There are feed port lists in the trash."
" These will be excluded from the sync.",
__func__);
}
}
9 changes: 9 additions & 0 deletions src/manage_sql_report_formats.c
Original file line number Diff line number Diff line change
Expand Up @@ -4558,6 +4558,15 @@ check_db_report_formats ()
if (make_report_format_uuids_unique ())
return -1;

/* Warn about feed resources in the trash. */
if (sql_int ("SELECT EXISTS (SELECT * FROM report_formats_trash"
" WHERE predefined = 1);"))
{
g_warning ("%s: There are feed report formats in the trash."
" These will be excluded from the sync.",
__func__);
}

return 0;
}

Expand Down

0 comments on commit 9ef78d0

Please sign in to comment.