Project

General

Profile

Actions

Bug #21091

closed

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

Added by Ondřej Pražák over 6 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Difficulty:
Triaged:
No
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.

Actions #1

Updated by The Foreman Bot over 6 years ago

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

Updated by Marek Hulán over 6 years ago

  • 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
  • translation missing: en.field_release set to 328
Actions #3

Updated by Ondřej Pražák over 6 years ago

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

Also available in: Atom PDF