Project

General

Profile

Bug #4379

Foreign key constraint error on deleting a class

Added by Ollie Lawson over 6 years ago. Updated about 3 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
Database
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:

Description

On deleting a class interface availible via the drop down menu on the nav bar the system bombs out with the following:

Warning!

ERROR: update or delete on table "puppetclasses" violates foreign key constraint "environment_classes_puppetclass_id_fk" on table "environment_classes" DETAIL: Key (id)=(8) is still referenced from table "environment_classes".

Stack Trace:
PGError
ERROR: update or delete on table "puppetclasses" violates foreign key constraint "environment_classes_puppetclass_id_fk" on table "environment_classes" DETAIL: Key (id)=(8) is still referenced from table "environment_classes".
app/controllers/puppetclasses_controller.rb:42:in `destroy'
app/models/concerns/foreman/thread_session.rb:33:in `clear_thread'
lib/middleware/catch_json_parse_errors.rb:9:in `call'

Capture.PNG View Capture.PNG 30.3 KB Ollie Lawson, 02/18/2014 03:00 PM
foreman_class_removal_error.jpg View foreman_class_removal_error.jpg 138 KB Bryce Camp, 02/21/2014 04:53 PM
Capture Foreman class removal error

Related issues

Has duplicate Foreman - Bug #5225: Deleting a puppet-class: Mysql2::Error: Cannot delete or update a parent row: a foreign key constraint failsDuplicate2014-04-17
Has duplicate Foreman - Bug #5213: Error during delete a puppet classDuplicate2014-04-16
Has duplicate Foreman - Bug #6045: deleting a class failsDuplicate2014-06-03
Has duplicate Foreman - Bug #7255: unable to delete puppet classDuplicate2014-08-25

History

#1 Updated by Bryce Camp over 6 years ago

I am experiencing the same issue

#2 Updated by Dominic Cleal over 6 years ago

  • Category set to Database

#3 Updated by Marek Hulán over 6 years ago

  • Has duplicate Bug #5225: Deleting a puppet-class: Mysql2::Error: Cannot delete or update a parent row: a foreign key constraint fails added

#4 Updated by Dominic Cleal over 6 years ago

  • Has duplicate Bug #5213: Error during delete a puppet class added

#5 Updated by Eric Goedtel about 6 years ago

Its not explicitly stated here but you can work around this by removing the module from the applicable environment directory on the puppet master Foreman is interacting with.

#6 Updated by Dominic Cleal about 6 years ago

  • Has duplicate Bug #6045: deleting a class fails added

#7 Updated by Yama Kasi almost 6 years ago

I'm also facing this problem.

Even removing the Puppet module doesn't fix this at the moment. I'm stuck with some classes that are not there but FM thinks they are (in use).

Any ideas ?

#8 Updated by Yama Kasi almost 6 years ago

I'm on 1.5.2 at the moment.

#9 Updated by Yama Kasi almost 6 years ago

OK, update... fixed. It seems that Foreman is importing "conflicting" classes form other modules with the same name (as you copy them over and edit them half)

#10 Updated by Jem Sebban almost 6 years ago

Hello,

I'm also running Centos 6.5 and have a similar issue while trying to delete classes from foreman web UI.
Puppet version is latest from puppetlabs repo - 3.6.2-1
Foreman version is 1.5.2-1, also current.

Only "exotic" aspect of my setup is I recently updated puppet from 2.7.x (EPEL) to 3.6.x (puppetlabs)

What kind of update did fix this for you Yama Kasi ? Is the UI delete button now working as expected ?

I was able to delete classes by manually removing them form their environment directory but I would like to be able to do that from the UI to ease collaboration with my colleagues.

#11 Updated by Anonymous almost 6 years ago

  • Has duplicate Bug #7255: unable to delete puppet class added

#12 Updated by Dominic Cleal almost 6 years ago

  • Bugzilla link set to 1147379

#13 Updated by Tom Caspy over 5 years ago

this is quite odd, as the relation has dependent: true on it. How can we reproduce this?

#14 Updated by Anonymous about 3 years ago

  • Status changed from New to Resolved

the linked BZ got closed

Also available in: Atom PDF