Conversation
Extract report host related SQL and XML generation logic from the existing report handling code into dedicated report hosts modules. Keep the existing behavior unchanged and prepare the codebase for a separate get_report_hosts GMP command.
Add management-layer handling for sending report host XML separately from get_reports. Reuse the existing filtering and host selection logic, including result_hosts_only and container scan handling, so host-only responses can be generated without changing the existing report output.
Introduce the get_report_hosts GMP command for retrieving host data from a single report. Support report_id, filter parsing and lean mode, and route the command through the new management-layer report hosts handling.
mattmundell
left a comment
There was a problem hiding this comment.
The new command and the report host extraction look like great ideas.
cd7e0c8 to
eaa5ae3
Compare
4ce038c to
45d7914
Compare
src/schema_formats/XML/GMP.xml.in
Outdated
| </summary> | ||
| </option> | ||
| <option> | ||
| <name>rows</name> |
There was a problem hiding this comment.
I'm wondering about these options. From what I can see they still need to be implemented. I guess that will be quite complex (for one, due to result_hosts_only there may need to also be a result filter in GET_REPORT_HOSTS).
If it's going to be some time until they're implemented then maybe they should be hidden here.
Co-authored-by: Matt Mundell <32057441+mattmundell@users.noreply.github.com>
Extract duplicated report filter control setup into a shared helper and use it in manage_report_hosts and manage_sql_report_hosts. Remove duplicate initialization in gmp_report_hosts.c and guard temporary directory cleanup with a dedicated mkdtemp success flag.
Document the lean parameter for report hosts and remove options that are not currently implemented to keep the GMP documentation aligned with actual behavior.
src/manage_report_hosts.c
Outdated
| &term, | ||
| NULL, | ||
| NULL, | ||
| &sort_field, |
There was a problem hiding this comment.
Any reason for keeping this (and levels, compliance_levels, delta_stats, search_phrase and zone)?
Any arg to manage_report_filter_controls that comes after term is allowed to be NULL. And print_report_hosts_xml only needs f_host* in ctx.
src/schema_formats/XML/GMP.xml.in
Outdated
There was a problem hiding this comment.
Hmm, looking at this again I think these are actually used, but they're used to filter the results instead of the hosts. I see that the get arg is passed to fill_filtered_results_hosts and then to the result iterator. Whereas the get arg is also passed to print_report_hosts_xml but is barely used there. Do you agree?
Perhaps it's better to make it clear here that this is filtering the results. We have a precedent in GET_REPORTS which has both filter and report_filter. The GET_REPORT doc just makes it clear what each is for.
In the future there could be a report_hosts_filter.
There was a problem hiding this comment.
I agree that the current behavior is result-driven rather than a pure host-level filter. I have adjusted the code accordingly, and I can follow up with a doc clarification as well.
What
get_report_hostsGMP command.Why
References
GEA-1692