How to remove OpenSCAP reports using API in Red Hat Satellite 6?
Environment
- Red Hat Satellite 6
Issue
- What
APIcan be used to remove OpenSCAP reports in Red Hat Satellite 6?
Resolution
-
The following steps can be followed to collect report
idsand delete them using theAPIin Red Hat Satellite 6:-
List all OpenSCAP reports using the following
API:# curl --insecure --request GET --user username:password --header "Content-Type:application/json" -k https://satellite.example.com/api/v2/compliance/arf_reports| python3 -m json.tool -
Note the report
idfrom the output of the aboveAPIas in following example output:... ... "results": [ { "created_at": "2024-04-30 19:36:09 UTC", "updated_at": "2024-04-30 19:36:09 UTC", "reported_at": "2024-04-30 19:36:08 UTC", "id": 4086, <<<< Report Id "passed": 0, "failed": 0, "othered": 0, ... ... -
Use the following
APItodeletethe OpenSCAP report, replacing$idwith the noted reportidfrom the above example:# curl --insecure --request DELETE --user username:password --header "Content-Type:application/json" -k https://satellite.example.com/api/v2/compliance/arf_reports/$Id | python3 -m json.tool
-
-
If it is required to clean all OpenSCAP reports, following foreman-rake command can be used on the Satellite server:
# foreman-rake reports:expire report_type=ForemanOpenscap::ArfReport days=0- where
report_typetargets OpenSCAP data anddays=0means keeping nothing.
- where
For more KB articles/solutions related to Red Hat Satellite 6.x OpenSCAP Issues, please refer to the Red Hat Satellite Consolidated Troubleshooting Article for Red Hat Satellite 6.x OpenSCAP Issues
For more KB articles/solutions related to Red Hat Satellite 6.x API Issues, please refer to the Red Hat Satellite Consolidated Troubleshooting Article for Red Hat Satellite 6.x API Issues
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.