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

Fix: Make report configs optional for new alerts #178

Merged
merged 1 commit into from
Jul 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 40 additions & 36 deletions src/gsad_gmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -4138,44 +4138,48 @@

/* Get Report Configs. */

ret = gmp (connection, credentials, &response, &entity, response_data,
"<get_report_configs filter=\"rows=-1\"/>");
switch (ret)
if (command_enabled (credentials, "GET_REPORT_CONFIGS"))
{
case 0:
case -1:
break;
case 1:
cmd_response_data_set_status_code (response_data,
MHD_HTTP_INTERNAL_SERVER_ERROR);
return gsad_message (
credentials, "Internal error", __func__, __LINE__,
"An internal error occurred while getting Report "
"Configs for new alert. "
"Diagnostics: Failure to send command to manager daemon.",
response_data);
case 2:
cmd_response_data_set_status_code (response_data,
MHD_HTTP_INTERNAL_SERVER_ERROR);
return gsad_message (
credentials, "Internal error", __func__, __LINE__,
"An internal error occurred while getting Report "
"Configs for new alert. "
"Diagnostics: Failure to receive response from manager daemon.",
response_data);
default:
cmd_response_data_set_status_code (response_data,
MHD_HTTP_INTERNAL_SERVER_ERROR);
return gsad_message (credentials, "Internal error", __func__, __LINE__,
"An internal error occurred while getting Report "
"Configs for new alert. It is unclear whether"
" the alert has been saved or not. "
"Diagnostics: Internal Error.",
response_data);
ret = gmp (connection, credentials, &response, &entity, response_data,

Check warning on line 4143 in src/gsad_gmp.c

View check run for this annotation

Codecov / codecov/patch

src/gsad_gmp.c#L4143

Added line #L4143 was not covered by tests
"<get_report_configs filter=\"rows=-1\"/>");
switch (ret)

Check warning on line 4145 in src/gsad_gmp.c

View check run for this annotation

Codecov / codecov/patch

src/gsad_gmp.c#L4145

Added line #L4145 was not covered by tests
{
case 0:

Check warning on line 4147 in src/gsad_gmp.c

View check run for this annotation

Codecov / codecov/patch

src/gsad_gmp.c#L4147

Added line #L4147 was not covered by tests
case -1:
break;
case 1:
cmd_response_data_set_status_code (response_data,

Check warning on line 4151 in src/gsad_gmp.c

View check run for this annotation

Codecov / codecov/patch

src/gsad_gmp.c#L4149-L4151

Added lines #L4149 - L4151 were not covered by tests
MHD_HTTP_INTERNAL_SERVER_ERROR);
return gsad_message (

Check warning on line 4153 in src/gsad_gmp.c

View check run for this annotation

Codecov / codecov/patch

src/gsad_gmp.c#L4153

Added line #L4153 was not covered by tests
credentials, "Internal error", __func__, __LINE__,
"An internal error occurred while getting Report "
"Configs for new alert. "
"Diagnostics: Failure to send command to manager daemon.",
response_data);
case 2:
cmd_response_data_set_status_code (response_data,

Check warning on line 4160 in src/gsad_gmp.c

View check run for this annotation

Codecov / codecov/patch

src/gsad_gmp.c#L4159-L4160

Added lines #L4159 - L4160 were not covered by tests
MHD_HTTP_INTERNAL_SERVER_ERROR);
return gsad_message (

Check warning on line 4162 in src/gsad_gmp.c

View check run for this annotation

Codecov / codecov/patch

src/gsad_gmp.c#L4162

Added line #L4162 was not covered by tests
credentials, "Internal error", __func__, __LINE__,
"An internal error occurred while getting Report "
"Configs for new alert. "
"Diagnostics: Failure to receive response from manager daemon.",
response_data);
default:
cmd_response_data_set_status_code (response_data,

Check warning on line 4169 in src/gsad_gmp.c

View check run for this annotation

Codecov / codecov/patch

src/gsad_gmp.c#L4168-L4169

Added lines #L4168 - L4169 were not covered by tests
MHD_HTTP_INTERNAL_SERVER_ERROR);
return gsad_message (

Check warning on line 4171 in src/gsad_gmp.c

View check run for this annotation

Codecov / codecov/patch

src/gsad_gmp.c#L4171

Added line #L4171 was not covered by tests
credentials, "Internal error", __func__, __LINE__,
"An internal error occurred while getting Report "
"Configs for new alert. It is unclear whether"
" the alert has been saved or not. "
"Diagnostics: Internal Error.",
response_data);
}
g_string_append (xml, response);
g_free (response);
free_entity (entity);

Check warning on line 4181 in src/gsad_gmp.c

View check run for this annotation

Codecov / codecov/patch

src/gsad_gmp.c#L4179-L4181

Added lines #L4179 - L4181 were not covered by tests
}
g_string_append (xml, response);
g_free (response);
free_entity (entity);

/* Get Report Filters. */

Expand Down
Loading