Skip to content

Commit

Permalink
Rename pending status to queued
Browse files Browse the repository at this point in the history
  • Loading branch information
jjnicola committed Jun 2, 2020
1 parent b980633 commit ee68772
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Add --rebuild-scap option [#1051](https://github.com/greenbone/gvmd/pull/1051)
- Stop current scheduling of task when permission denied [#1058](https://github.com/greenbone/gvmd/pull/1058)
- Trim malloc heap after updating cache [#1085](https://github.com/greenbone/gvmd/pull/1085)
- Handle PENDING osp scan status. [#1113](https://github.com/greenbone/gvmd/pull/1113)
- Handle QUEUED osp scan status. [#1113](https://github.com/greenbone/gvmd/pull/1113)

### Changed
- Update SCAP and CERT feed info in sync scripts [#810](https://github.com/greenbone/gvmd/pull/810)
Expand Down
28 changes: 14 additions & 14 deletions src/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -1576,7 +1576,7 @@ run_status_name (task_status_t status)

case TASK_STATUS_RUNNING: return "Running";

case TASK_STATUS_PENDING: return "Pending";
case TASK_STATUS_QUEUED: return "Queued";

case TASK_STATUS_STOP_REQUESTED_GIVEUP:
case TASK_STATUS_STOP_REQUESTED:
Expand Down Expand Up @@ -1613,7 +1613,7 @@ run_status_name_internal (task_status_t status)

case TASK_STATUS_RUNNING: return "Running";

case TASK_STATUS_PENDING: return "Pending";
case TASK_STATUS_QUEUED: return "Queued";

case TASK_STATUS_STOP_REQUESTED_GIVEUP:
case TASK_STATUS_STOP_REQUESTED:
Expand Down Expand Up @@ -2926,7 +2926,7 @@ slave_setup (gvm_connection_t *connection, const char *name, task_t task,
case TASK_STATUS_NEW:
case TASK_STATUS_REQUESTED:
case TASK_STATUS_RUNNING:
case TASK_STATUS_PENDING:
case TASK_STATUS_QUEUED:
case TASK_STATUS_STOP_WAITING:
case TASK_STATUS_INTERRUPTED:
break;
Expand Down Expand Up @@ -3550,7 +3550,7 @@ handle_osp_scan (task_t task, report_t report, const char *scan_id)
char *host, *ca_pub, *key_pub, *key_priv;
int rc, port;
scanner_t scanner;
gboolean started, pending_status_updated;
gboolean started, queued_status_updated;

scanner = task_scanner (task);
host = scanner_host (scanner);
Expand All @@ -3559,7 +3559,7 @@ handle_osp_scan (task_t task, report_t report, const char *scan_id)
key_pub = scanner_key_pub (scanner);
key_priv = scanner_key_priv (scanner);
started = FALSE;
pending_status_updated = FALSE;
queued_status_updated = FALSE;

while (1)
{
Expand Down Expand Up @@ -3615,13 +3615,13 @@ handle_osp_scan (task_t task, report_t report, const char *scan_id)
osp_scan_status = get_osp_scan_status (scan_id, host, port,
ca_pub, key_pub, key_priv);

if (osp_scan_status == OSP_SCAN_STATUS_PENDING
&& pending_status_updated == FALSE)
if (osp_scan_status == OSP_SCAN_STATUS_QUEUED
&& queued_status_updated == FALSE)
{
set_task_run_status (task, TASK_STATUS_PENDING);
set_task_run_status (task, TASK_STATUS_QUEUED);
set_report_scan_run_status (global_current_report,
TASK_STATUS_PENDING);
pending_status_updated = TRUE;
TASK_STATUS_QUEUED);
queued_status_updated = TRUE;
}
else if (progress >= 0 && progress < 100
&& osp_scan_status == OSP_SCAN_STATUS_STOPPED)
Expand Down Expand Up @@ -4021,10 +4021,10 @@ prepare_osp_scan_for_resume (task_t task, const char *scan_id, char **error)
}
}
else if (status == OSP_SCAN_STATUS_RUNNING
|| status == OSP_SCAN_STATUS_PENDING
|| status == OSP_SCAN_STATUS_QUEUED
|| status == OSP_SCAN_STATUS_FINISHED)
{
g_debug ("%s: Scan %s pending, running or finished", __func__, scan_id);
g_debug ("%s: Scan %s queued, running or finished", __func__, scan_id);
/* It would be possible to simply continue getting the results
* from the scanner, but gvmd may have crashed while receiving
* or storing the results, so some may be missing. */
Expand Down Expand Up @@ -5753,7 +5753,7 @@ stop_task_internal (task_t task)
run_status = task_run_status (task);
if (run_status == TASK_STATUS_REQUESTED
|| run_status == TASK_STATUS_RUNNING
|| run_status == TASK_STATUS_PENDING)
|| run_status == TASK_STATUS_QUEUED)
{
set_task_run_status (task, TASK_STATUS_STOP_REQUESTED);
return 1;
Expand Down Expand Up @@ -5931,7 +5931,7 @@ move_task (const char *task_id, const char *slave_id)
return 5;
break;
case TASK_STATUS_RUNNING:
case TASK_STATUS_PENDING:
case TASK_STATUS_QUEUED:
if (task_scanner_type == SCANNER_TYPE_CVE)
return 6;
// Check permissions to stop and resume task
Expand Down
2 changes: 1 addition & 1 deletion src/manage.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ typedef enum
TASK_STATUS_STOP_REQUESTED_GIVEUP = 15,
TASK_STATUS_DELETE_WAITING = 16,
TASK_STATUS_DELETE_ULTIMATE_WAITING = 17,
TASK_STATUS_PENDING = 18
TASK_STATUS_QUEUED = 18
} task_status_t;

/**
Expand Down
6 changes: 3 additions & 3 deletions src/manage_pg.c
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,7 @@ manage_create_sql_functions ()
TASK_STATUS_STOP_REQUESTED_GIVEUP,
TASK_STATUS_STOPPED,
TASK_STATUS_INTERRUPTED,
TASK_STATUS_PENDING);
TASK_STATUS_QUEUED);

sql ("CREATE OR REPLACE FUNCTION report_progress (integer)"
" RETURNS integer AS $$"
Expand Down Expand Up @@ -1326,7 +1326,7 @@ manage_create_sql_functions ()
" WHEN $1 = %i"
" THEN 'Stopped'"
" WHEN $1 = %i"
" THEN 'Pending'"
" THEN 'Queued'"
" ELSE 'Interrupted'"
" END;"
"$$ LANGUAGE SQL"
Expand All @@ -1343,7 +1343,7 @@ manage_create_sql_functions ()
TASK_STATUS_STOP_REQUESTED,
TASK_STATUS_STOP_WAITING,
TASK_STATUS_STOPPED,
TASK_STATUS_PENDING);
TASK_STATUS_QUEUED);

if (sql_int ("SELECT EXISTS (SELECT * FROM information_schema.tables"
" WHERE table_catalog = '%s'"
Expand Down
24 changes: 12 additions & 12 deletions src/manage_sql.c
Original file line number Diff line number Diff line change
Expand Up @@ -2796,7 +2796,7 @@ keyword_applies_to_column (keyword_t *keyword, const char* column)
&& (strstr ("Done", keyword->string) == NULL)
&& (strstr ("New", keyword->string) == NULL)
&& (strstr ("Running", keyword->string) == NULL)
&& (strstr ("Pending", keyword->string) == NULL)
&& (strstr ("Queued", keyword->string) == NULL)
&& (strstr ("Stop Requested", keyword->string) == NULL)
&& (strstr ("Stopped", keyword->string) == NULL)
&& (strstr ("Interrupted", keyword->string) == NULL))
Expand Down Expand Up @@ -15226,7 +15226,7 @@ task_in_use (task_t task)
|| status == TASK_STATUS_DELETE_ULTIMATE_WAITING
|| status == TASK_STATUS_REQUESTED
|| status == TASK_STATUS_RUNNING
|| status == TASK_STATUS_PENDING
|| status == TASK_STATUS_QUEUED
|| status == TASK_STATUS_STOP_REQUESTED_GIVEUP
|| status == TASK_STATUS_STOP_REQUESTED
|| status == TASK_STATUS_STOP_WAITING;
Expand Down Expand Up @@ -16344,7 +16344,7 @@ stop_active_tasks ()
case TASK_STATUS_DELETE_WAITING:
case TASK_STATUS_REQUESTED:
case TASK_STATUS_RUNNING:
case TASK_STATUS_PENDING:
case TASK_STATUS_QUEUED:
case TASK_STATUS_STOP_REQUESTED_GIVEUP:
case TASK_STATUS_STOP_REQUESTED:
case TASK_STATUS_STOP_WAITING:
Expand Down Expand Up @@ -16389,7 +16389,7 @@ stop_active_tasks ()
TASK_STATUS_DELETE_WAITING,
TASK_STATUS_REQUESTED,
TASK_STATUS_RUNNING,
TASK_STATUS_PENDING,
TASK_STATUS_QUEUED,
TASK_STATUS_STOP_REQUESTED,
TASK_STATUS_STOP_REQUESTED_GIVEUP,
TASK_STATUS_STOP_WAITING);
Expand Down Expand Up @@ -17827,7 +17827,7 @@ set_task_requested (task_t task, task_status_t *status)
run_status = task_run_status (task);
if (run_status == TASK_STATUS_REQUESTED
|| run_status == TASK_STATUS_RUNNING
|| run_status == TASK_STATUS_PENDING
|| run_status == TASK_STATUS_QUEUED
|| run_status == TASK_STATUS_STOP_REQUESTED
|| run_status == TASK_STATUS_STOP_REQUESTED_GIVEUP
|| run_status == TASK_STATUS_STOP_WAITING
Expand Down Expand Up @@ -17902,15 +17902,15 @@ task_running_report (task_t task)
task_status_t run_status = task_run_status (task);
if (run_status == TASK_STATUS_REQUESTED
|| run_status == TASK_STATUS_RUNNING
|| run_status == TASK_STATUS_PENDING)
|| run_status == TASK_STATUS_QUEUED)
{
return (unsigned int) sql_int ("SELECT max(id) FROM reports"
" WHERE task = %llu AND end_time IS NULL"
" AND (scan_run_status = %u "
" OR scan_run_status = %u);",
task,
TASK_STATUS_RUNNING,
TASK_STATUS_PENDING);
TASK_STATUS_QUEUED);
}
return (report_t) 0;
}
Expand All @@ -17929,7 +17929,7 @@ task_iterator_current_report (iterator_t *iterator)
task_status_t run_status = task_iterator_run_status (iterator);
if (run_status == TASK_STATUS_REQUESTED
|| run_status == TASK_STATUS_RUNNING
|| run_status == TASK_STATUS_PENDING
|| run_status == TASK_STATUS_QUEUED
|| run_status == TASK_STATUS_DELETE_REQUESTED
|| run_status == TASK_STATUS_DELETE_ULTIMATE_REQUESTED
|| run_status == TASK_STATUS_STOP_REQUESTED
Expand All @@ -17951,7 +17951,7 @@ task_iterator_current_report (iterator_t *iterator)
task,
TASK_STATUS_REQUESTED,
TASK_STATUS_RUNNING,
TASK_STATUS_PENDING,
TASK_STATUS_QUEUED,
TASK_STATUS_DELETE_REQUESTED,
TASK_STATUS_DELETE_ULTIMATE_REQUESTED,
TASK_STATUS_STOP_REQUESTED,
Expand Down Expand Up @@ -24598,7 +24598,7 @@ delete_report_internal (report_t report)
" OR scan_run_status = %u OR scan_run_status = %u);",
report,
TASK_STATUS_RUNNING,
TASK_STATUS_PENDING,
TASK_STATUS_QUEUED,
TASK_STATUS_REQUESTED,
TASK_STATUS_DELETE_REQUESTED,
TASK_STATUS_DELETE_ULTIMATE_REQUESTED,
Expand Down Expand Up @@ -41744,7 +41744,7 @@ task_schedule_iterator_stop_due (iterator_t* iterator)

if (run_status == TASK_STATUS_RUNNING
|| run_status == TASK_STATUS_REQUESTED
|| run_status == TASK_STATUS_PENDING)
|| run_status == TASK_STATUS_QUEUED)
{
time_t now, start;

Expand Down Expand Up @@ -52393,7 +52393,7 @@ delete_user (const char *user_id_arg, const char *name_arg, int ultimate,
case TASK_STATUS_DELETE_WAITING:
case TASK_STATUS_REQUESTED:
case TASK_STATUS_RUNNING:
case TASK_STATUS_PENDING:
case TASK_STATUS_QUEUED:
case TASK_STATUS_STOP_REQUESTED_GIVEUP:
case TASK_STATUS_STOP_REQUESTED:
case TASK_STATUS_STOP_WAITING:
Expand Down

0 comments on commit ee68772

Please sign in to comment.