Project

General

Profile

Actions

Bug #22792

closed

Trying to delete compute resource associated with hostgroup gives PG::ForeignKeyViolation: ERROR

Added by Nikhil Kathole about 6 years ago. Updated almost 3 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
Host groups
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

Steps:

1. Create compute resource
2. Create hostgroup associating compute resource
3. Try to delete compute resource

Actual result:
Error on UI and logs/development.log showed

2018-03-06T13:50:23 19db69a6 [app] [I] Started DELETE "/compute_resources/4-external_libvirt" for ::1 at 2018-03-06 13:50:23 +0000
2018-03-06T13:50:23 19db69a6 [app] [I] Processing by ComputeResourcesController#destroy as HTML
2018-03-06T13:50:23 19db69a6 [app] [I]   Parameters: {"authenticity_token"=>"7/WWEy77BbM0FROrjTDaqERugRFs05ERobs6w1bB8C42UsCPh9HnG4UOkPi4HK1WJwv84dzIOAh5DgdYsHwKiw==", "id"=>"4-external_libvirt"}
2018-03-06T13:50:23 19db69a6 [app] [I] Current user: admin (administrator)
2018-03-06T13:50:23 19db69a6 [app] [D] Setting current user thread-local variable to admin
2018-03-06T13:50:23 19db69a6 [app] [D] Setting current location thread-local variable to Default Location
2018-03-06T13:50:23 19db69a6 [app] [D] Setting current organization thread-local variable to Default Organization
2018-03-06T13:50:23 19db69a6 [app] [I] Completed 500 Internal Server Error in 43ms (ActiveRecord: 9.5ms)
 |
 |
2018-03-06T13:50:23 19db69a6 [app] [F]
2018-03-06T13:50:23 19db69a6 [app] [F] ActiveRecord::InvalidForeignKey (PG::ForeignKeyViolation: ERROR:  update or delete on table "compute_resources" violates foreign key constraint "fk_rails_61ca956e9a" on table "hostgroups" 
 | DETAIL:  Key (id)=(4) is still referenced from table "hostgroups".
 | : DELETE FROM "compute_resources" WHERE "compute_resources"."type" IN ('Foreman::Model::Libvirt') AND "compute_resources"."id" = $1):
2018-03-06T13:50:23 19db69a6 [app] [F]
2018-03-06T13:50:23 19db69a6 [app] [F] app/controllers/compute_resources_controller.rb:76:in `destroy'
 | app/controllers/concerns/application_shared.rb:15:in `set_timezone'
 | app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
 | app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
 | lib/middleware/telemetry.rb:9:in `call'
 | lib/middleware/catch_json_parse_errors.rb:8:in `call'
 | lib/middleware/session_safe_logging.rb:17:in `call'
 | lib/middleware/tagged_logging.rb:18:in `call'
 | /home/vagrant/katello/lib/katello/prevent_json_parsing.rb:12:in `call'
2018-03-06T13:50:23 19db69a6 [app] [I]   Rendered /home/vagrant/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.4/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (33.0ms)

Expected result:

Warning as it is used by hostgroup.


Files


Related issues 1 (0 open1 closed)

Related to Foreman - Feature #5790: Default "Deploy on" value for host groups.ClosedOndřej PražákActions
Actions #1

Updated by Ivan Necas about 6 years ago

  • Related to Feature #5790: Default "Deploy on" value for host groups. added
Actions #2

Updated by Ivan Necas about 6 years ago

  • Category set to Host groups
Actions #3

Updated by yifat makias almost 3 years ago

  • Status changed from New to Resolved
Actions

Also available in: Atom PDF