Bug #4416

500 FK error when deleting old image in compute resource

Added by Daniel Lobato Garcia over 3 years ago. Updated over 3 years ago.

Status:Closed
Priority:Normal
Assigned To:Joseph Magen
Category:Compute resources
Target version:Sprint 25
Difficulty: Bugzilla link:1114646
Found in release: Pull request:
Story points-
Velocity based estimate-
Release1.5.2Release relationshipAuto

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 over 3 years ago

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

Revision 3d5d2c5c
Added by Joseph Magen over 3 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 over 3 years ago

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

#2 Updated by Joseph Magen over 3 years ago

  • Status changed from New to Assigned
  • Assigned To set to Joseph Magen
  • Target version set to Sprint 25

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

#3 Updated by Dominic Cleal over 3 years ago

  • Status changed from Assigned to Ready For Testing
  • Release set to 1.5.2

#4 Updated by Joseph Magen over 3 years ago

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

#5 Updated by Bryan Kearney over 3 years ago

  • Bugzilla link set to 1114646

Also available in: Atom PDF