Project

General

Profile

Bug #23415

Clear taxable_taxonomies created by audit records on taxonomy deletion

Added by Kavita Gaikwad 6 months ago. Updated 3 months ago.

Status:
Closed
Priority:
Normal
Category:
-
Target version:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

Description:

Error:
Katello::OrganizationTestDelete#test_org_being_deleted:
ActiveRecord::InvalidForeignKey: PG::ForeignKeyViolation: ERROR: update or delete on table "taxonomies" violates foreign key constraint "taxable_taxonomies_taxonomy_id_fk" on table "taxable_taxonomies"
DETAIL: Key (id)=(61304186) is still referenced from table "taxable_taxonomies".
: DELETE FROM "taxonomies" WHERE "taxonomies"."type" IN ('Organization') AND "taxonomies"."id" = $1
foreman-tasks (0.13.0) app/models/foreman_tasks/concerns/action_triggering.rb:35:in `block in destroy'
foreman-tasks (0.13.0) app/models/foreman_tasks/concerns/action_triggering.rb:121:in `dynflow_task_wrap'
foreman-tasks (0.13.0) app/models/foreman_tasks/concerns/action_triggering.rb:35:in `destroy'
/var/lib/workspace/workspace/katello-pr-test/app/models/katello/concerns/organization_extensions.rb:114:in `destroy!'
/var/lib/workspace/workspace/katello-pr-test/test/models/organization_test.rb:15:in `test_org_being_deleted'

Explanation on above error:
- For many resources, we have added audited which covers all CURD actions.
- Though we already added taxable_taxonomies :dependent => :destroy, when we try to destroy any taxonomy, it tries to destroy all dependent resources.
And which leads to many more audit records.
- These audit records creation occured after the deletion of existing taxable_taxonomies by :dependent => :destroy.
- For these audit records, taxable_taxonomies records get created which needs to be clear before taxonomy destroy.


Related issues

Blocks Katello - Feature #22690: [Audit] Add audit to more Katello resources - Content-view, Repository, Lifecycle environment and their associationsClosed2018-02-26

Associated revisions

Revision 3a7c816a (diff)
Added by Kavita Gaikwad 6 months ago

Fixes #23415 - nullify taxonomy associations for audits (#5502)

On taxonomy destroy, nullify taxonomy associations for audit
records that are created by 'destroy' action on dependent
resources.

History

#1 Updated by Kavita Gaikwad 6 months ago

  • Related to Feature #22690: [Audit] Add audit to more Katello resources - Content-view, Repository, Lifecycle environment and their associations added

#2 Updated by Kavita Gaikwad 6 months ago

  • Related to deleted (Feature #22690: [Audit] Add audit to more Katello resources - Content-view, Repository, Lifecycle environment and their associations)

#3 Updated by Kavita Gaikwad 6 months ago

  • Blocks Feature #22690: [Audit] Add audit to more Katello resources - Content-view, Repository, Lifecycle environment and their associations added

#4 Updated by The Foreman Bot 6 months ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/5502 added

#5 Updated by Marek Hulán 6 months ago

  • Legacy Backlogs Release (now unused) set to 330

setting the 1.18 as this is required so other plugins can use the feature from 1.18, please let me know if there is a concern, but the patch is extremely safe to cherry-pick

#6 Updated by The Foreman Bot 6 months ago

  • Pull request https://github.com/theforeman/foreman/pull/5505 added

#7 Updated by Kavita Gaikwad 6 months ago

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

Also available in: Atom PDF