Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Cause: the system let arf reports being created even if host didn't have any openscap proxy assigned
Consequence: such report did not get the link to proxy so later when we tried to work with the report, it failed. Also when user tried to delete the report host, it failed since the report could not be deleted.
Fix: we do no longer import arf reports for hosts that do not have any openscap proxy set. Also we provide a rake task to clean all existing arf reports without proxy set. To use it, run the following
foreman-rake foreman_openscap:clean_reports_without_proxy
Result: After running the rake task, all reports that miss a link to a proxy will be deleted, which restores the ability to delete a host that had such report. No more reports should appear anymore.
Created attachment 1327735[details]
screenshot of UI deleting host
Description of problem: We had registered a content host to satellite and generated oscap arf_report.Later we unregistered the host and also deleted that host from UI.Now again registered the same host and generated oscap arf_report.The report generated under Hosts -> Reports and showed "No capsule found" in Oscap capsule column.Now, when we were trying to delete that content host, it shows "Error: PG::Error: ERROR: update or delete on table "hosts" violates foreign key constraint "reports_host_id_fk" on table "reports" DETAIL: Key (id)=(21) is still referenced from table "reports". : DELETE FROM "hosts" WHERE "hosts"."type" IN ('Host::Managed') AND "hosts"."id" = $1"
Version-Release number of selected component (if applicable):satellite 6.3 snap 16
How reproducible:always
Steps to Reproduce:
1. Register a content host
2. Generate arf report
3. Unregister the host
4. Delete host from UI
5. Register same host
6. Generate arf report
7. Try to delete a host
Actual results:
Could not delete host and It shows error as "Error: PG::Error: ERROR: update or delete on table "hosts" violates foreign key constraint "reports_host_id_fk" on table "reports" DETAIL: Key (id)=(21) is still referenced from table "reports". : DELETE FROM "hosts" WHERE "hosts"."type" IN ('Host::Managed') AND "hosts"."id" = $1"
Expected results:
The host should be deleted and arf_reports of that host also be deleted as well.
Additional info:
Host can be deleted once we delete generated arf report.
VERIFIED
Version Tested:
Satellite-6.3 Snap 27
steps:
1. Registered a content host
2. Generated arf report
3. Unregistered the host
4. Deleted host from UI
5. Registered same host
6. Generated arf report
arf report not uploaded in satellite as oscap capsule not attached and Production.log shows
2017-12-07 05:36:18 4475de61 [app] [I] Current user: foreman_api_admin (administrator)
2017-12-07 05:36:18 4475de61 [app] [E] Failed to upload Arf Report, no OpenSCAP Capsule set for host <hostname>
2017-12-07 05:36:18 4475de61 [app] [I] Completed 422 Unprocessable Entity in 72ms (Views: 0.9ms | ActiveRecord: 4.6ms)
As no arf report uploaded to satellite from host having no oscap capsule attached, host can be deleted successfully.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA.
For information on the advisory, and where to find the updated files, follow the link below.
If the solution does not work for you, open a new bug report.
https://access.redhat.com/errata/RHSA-2018:0336
Created attachment 1327735 [details] screenshot of UI deleting host Description of problem: We had registered a content host to satellite and generated oscap arf_report.Later we unregistered the host and also deleted that host from UI.Now again registered the same host and generated oscap arf_report.The report generated under Hosts -> Reports and showed "No capsule found" in Oscap capsule column.Now, when we were trying to delete that content host, it shows "Error: PG::Error: ERROR: update or delete on table "hosts" violates foreign key constraint "reports_host_id_fk" on table "reports" DETAIL: Key (id)=(21) is still referenced from table "reports". : DELETE FROM "hosts" WHERE "hosts"."type" IN ('Host::Managed') AND "hosts"."id" = $1" Version-Release number of selected component (if applicable):satellite 6.3 snap 16 How reproducible:always Steps to Reproduce: 1. Register a content host 2. Generate arf report 3. Unregister the host 4. Delete host from UI 5. Register same host 6. Generate arf report 7. Try to delete a host Actual results: Could not delete host and It shows error as "Error: PG::Error: ERROR: update or delete on table "hosts" violates foreign key constraint "reports_host_id_fk" on table "reports" DETAIL: Key (id)=(21) is still referenced from table "reports". : DELETE FROM "hosts" WHERE "hosts"."type" IN ('Host::Managed') AND "hosts"."id" = $1" Expected results: The host should be deleted and arf_reports of that host also be deleted as well. Additional info: Host can be deleted once we delete generated arf report.