Description of problem: When using the Remove Repository button the remove repository task fails with the following error: ActiveRecord::InvalidForeignKey: PGError: ERROR: update or delete on table "katello_repositories" violates foreign key constraint "filters_repositories_repository_id_fk" on table "katello_content_view_filters_repositories" DETAIL: Key (id)=(242) is still referenced from table "katello_content_view_filters_repositories". : DELETE FROM "katello_repositories" WHERE "katello_repositories"."id" = $1 How reproducible: Unknown Steps to Reproduce: 1. Create new repository 2. Add the new repository to a content-view 3. Add a rpm filter to the content-view that is applied to the new repository 4. On the Products page select the new repository and click the Remove Repository button. Actual results: The repository fails to be removed. The content view and products pages no longer load. Expected results: The repository should be successfully deleted. Additional info: When attempting to list the filters or get filter info on the filters attached to the repository that was attempted to be deleted "404 Resource Not Found" errors are returned. [automation@satellite ~]$ hammer content-view filter list --content-view-id=4 ----------|--------|------|---------- FILTER ID | NAME | TYPE | INCLUSION ----------|--------|------|---------- 2 | EPEL | rpm | true 1 | Puppet | rpm | ----------|--------|------|---------- [automation@satellite ~]$ hammer content-view filter list --content-view-id=6 404 Resource Not Found [automation@satellite ~]$ hammer content-view filter info --id=3 404 Resource Not Found [automation@satellite ~]$ hammer content-view filter info --id=4 404 Resource Not Found [automation@satellite ~]$ hammer content-view filter info --id=5 404 Resource Not Found [automation@satellite ~]$ hammer content-view filter info --id=6 Couldn't find Katello::ContentViewFilter with id=6
Verified with Latest snap16. The reported issue is no longer reproducible. Steps taken: 1 Created a new custom repo 2 sync the repo 3 created a new CV and added the repo created in step1 4 created a new package filter 4. Go to products page, click the product -> repo (created in step1) and remove the repo. With above steps. I was able to delete the repo as below: -- 2015-08-17 03:08:44 [I] Processing by Katello::Api::V2::RepositoriesController#destroy as JSON 2015-08-17 03:08:44 [I] Parameters: {"organization_id"=>"1", "api_version"=>"v2", "id"=>"17"} 2015-08-17 03:08:47 [I] Rendered /opt/rh/ruby193/root/usr/share/gems/gems/katello-2.2.0.66/app/views/katello/api/v2/common/destroy.json.rabl within katello/api/v2/layouts/resource (1.0ms) 2015-08-17 03:08:47 [I] Completed 200 OK in 2433ms (Views: 3.9ms | ActiveRecord: 0.0ms) -- I tried bulk remove repository with above step.. and not able to reproduce the reported issue. 2015-08-17 03:01:54 [I] Processing by Katello::Api::V2::RepositoriesBulkActionsController#destroy_repositories as JSON 2015-08-17 03:01:54 [I] Parameters: {"ids"=>[16], "organization_id"=>"1", "api_version"=>"v2", "repositories_bulk_action"=>{"ids"=>[16]}} 2015-08-17 03:01:54 [I] Rendered /opt/rh/ruby193/root/usr/share/gems/gems/katello-2.2.0.66/app/views/katello/api/v2/common/bulk_async.json.rabl within katello/api/v2/layouts/resource (38.2ms) 2015-08-17 03:01:54 [I] Completed 202 Accepted in 637ms (Views: 39.8ms | ActiveRecord: 1.2ms) 2015-08-17 03:01:55 [I] Processing by ForemanTasks::Api::TasksController#bulk_search as JSON 2015-08-17 03:01:55 [I] Parameters: {"searches"=>[{"type"=>"task", "task_id"=>"745e24db-fef8-4b1a-b1b2-9a6ccc72de38", "search_id"=>"1"}], "task"=>{}} 2015-08-17 03:01:55 [I] Completed 200 OK in 52ms (Views: 1.7ms | ActiveRecord: 2.2ms) 2015-08-17 03:01:57 [I] Processing by ForemanTasks::Api::TasksController#bulk_search as JSON 2015-08-17 03:01:57 [I] Parameters: {"searches"=>[{"type"=>"task", "task_id"=>"745e24db-fef8-4b1a-b1b2-9a6ccc72de38", "search_id"=>"1"}], "task"=>{}} 2015-08-17 03:01:57 [I] Completed 200 OK in 56ms (Views: 1.8ms | ActiveRecord: 2.3ms) 2015-08-17 03:01:58 [I] Processing by Katello::Api::V2::RepositoriesController#index as JSON 2015-08-17 03:01:58 [I] Parameters: {"enabled"=>"true", "full_result"=>"true", "library"=>"true", "organization_id"=>"1", "page"=>"1", "product_id"=>"128", "search"=>"", "api_version"=>"v2"} 2015-08-17 03:01:58 [I] Rendered /opt/rh/ruby193/root/usr/share/gems/gems/katello-2.2.0.66/app/views/katello/api/v2/repositories/index.json.rabl within katello/api/v2/layouts/collection (2.7ms) 2015-08-17 03:01:58 [I] Completed 200 OK in 36ms (Views: 6.8ms | ActiveRecord: 3.2ms) 2015-08-17 03:01:59 [I] Processing by ForemanTasks::Api::TasksController#bulk_search as JSON 2015-08-17 03:01:59 [I] Parameters: {"searches"=>[{"type"=>"task", "task_id"=>"745e24db-fef8-4b1a-b1b2-9a6ccc72de38", "search_id"=>"1"}], "task"=>{}} 2015-08-17 03:02:00 [I] Completed 200 OK in 55ms (Views: 1.8ms | ActiveRecord: 2.3ms) 2015-08-17 03:02:38 [I] Processing by Katello::Api::V2::RepositoriesController#index as JSON 2015-08-17 03:02:38 [I] Parameters: {"enabled"=>"true", "full_result"=>"true", "library"=>"true", "organization_id"=>"1", "page"=>"1", "product_id"=>"128", "search"=>"", "api_version"=>"v2"} 2015-08-17 03:02:38 [I] Rendered /opt/rh/ruby193/root/usr/share/gems/gems/katello-2.2.0.66/app/views/katello/api/v2/repositories/index.json.rabl within katello/api/v2/layouts/collection (1.6ms) 2015-08-17 03:02:38 [I] Completed 200 OK in 21ms (Views: 2.5ms | ActiveRecord: 2.9ms) I can load the content-view and product page properly after removing the repository.
I'm closing the bz as per comment1. If you come across this issue again, please feel free to re-open or file a new bz. Thanks