Bug #4416

500 FK error when deleting old image in compute resource

Added by Daniel Lobato Garcia over 4 years ago. Updated 6 days ago.

Status:Closed
Priority:Normal
Assignee:Joseph Magen
Category:Compute resources
Target version:1.5.2
Difficulty: Team Backlog:
Triaged: Fixed in Releases:
Bugzilla link:1114646 Found in Releases:
Pull request:

Description

After a compute resource is edited, or for some reason it no longer has an image, if Foreman had any images in the Compute Resource, deleting them will be impossible through the UI and will throw a 500 error.

Warning!
Mysql2::Error: Cannot delete or update a parent row: a foreign key constraint fails (`foreman`.`hosts`, CONSTRAINT `hosts_image_id_fk` FOREIGN KEY (`image_id`) REFERENCES `images` (`id`)): DELETE FROM `images` WHERE `images`.`id` = 3


Related issues

Duplicated by Foreman - Bug #6281: Attempting to remove openstack compute resource gives FK ... Duplicate 06/18/2014

Associated revisions

Revision e0d618ef
Added by Joseph Magen about 4 years ago

fixes #6216, #4416 - avoid foreign key errors when deleting some objects in use

Revision 3d5d2c5c
Added by Joseph Magen almost 4 years ago

fixes #6216, #4416 - avoid foreign key errors when deleting some objects in use

(cherry picked from commit e0d618efa6a8c02b46000bfcb9ded5eb672a6e13)

History

#1 Updated by Dominic Cleal about 4 years ago

  • Duplicated by Bug #6281: Attempting to remove openstack compute resource gives FK error added

#2 Updated by Joseph Magen about 4 years ago

  • Status changed from New to Assigned
  • Assignee set to Joseph Magen
  • Target version set to 1.8.1

https://github.com/theforeman/foreman/pull/1513, close manually after merge, since commit message is not #4416

#3 Updated by Dominic Cleal about 4 years ago

  • Status changed from Assigned to Ready For Testing
  • Legacy Backlogs Release (now unused) set to 18

#4 Updated by Joseph Magen about 4 years ago

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

#5 Updated by Bryan Kearney about 4 years ago

  • Bugzilla link set to 1114646

Also available in: Atom PDF