Project

General

Profile

Bug #21091

Can't delete host, if the host has a arf-report that has no capsule attached

Added by Ondřej Pražák almost 2 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Difficulty:
Triaged:
No
Bugzilla link:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

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"

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. The arf-report gets the openscap proxy from a host which it belongs to. When host has no openscap proxy set, arf_report is created without proxy as well, which also means it cannot be downloaded. The best solution here will be not to create arf_reports without proxy and let user know that host is misconfigured as soon as we detect it.

Associated revisions

Revision cc2a1524 (diff)
Added by Ondřej Pražák over 1 year ago

Fixes #21091 - Do not create Arf Reports without proxy id

History

#1 Updated by The Foreman Bot over 1 year ago

  • Assignee set to Ondřej Pražák
  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman_openscap/pull/308 added

#2 Updated by Marek Hulán over 1 year ago

  • Legacy Backlogs Release (now unused) set to 328
  • Subject changed from Can't delete host, if the host has a arf-report that has no capsule attached to Can't delete host, if the host has a arf-report that has no capsule attached

#3 Updated by Ondřej Pražák over 1 year ago

  • % Done changed from 0 to 100
  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF