Project

General

Profile

Bug #8904

Error when selecting repositories of a specific content view

Added by Moti Asayag over 7 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Urgent
Category:
Content Views
Target version:
Difficulty:
easy
Triaged:
Yes
Bugzilla link:
Fixed in Releases:
Found in Releases:
Red Hat JIRA:

Description

When a specific content view is selected and clicked for "Yum Content" --> "Repositories", no value is returned and an exception is logged.

Version-Release number of selected component (if applicable):
katello-2.1.0-2.el6.noarch

How reproducible:
always

Steps to Reproduce:
1. Select a content view
2. Select "Yum Content" --> "Repositories"

Actual results:
Nothing on WebUI + Exception in log:
Processing by Katello::Api::V2::RepositoriesController#index as JSON
Parameters: {"content_type"=>"yum", "content_view_id"=>"4", "full_result"=>"true", "organization_id"=>"5", "page"=>"1", "search"=>"", "api_version"=>"v2"}
ActiveRecord::StatementInvalid: PGError: ERROR: column reference "id" is ambiguous
LINE 1: SELECT id FROM "katello_repositories" INNER JOIN "katello_co...
^
: SELECT id FROM "katello_repositories" INNER JOIN "katello_content_view_repositories" ON "katello_content_view_repositories"."repository_id" = "katello_repositories"."id" WHERE "katello_repositories"."product_id" IN (SELECT "katello_products"."id" FROM "katello_products" WHERE "katello_products"."organization_id" = 5) AND "katello_content_view_repositories"."content_view_id" = 4 AND "katello_repositories"."content_type" = 'yum' ORDER BY katello_repositories.name ASC
...
/opt/rh/ruby193/root/usr/share/gems/gems/logging-1.8.1/lib/logging/diagnostic_context.rb:323:in `block in create_with_logging_context'
caused by: (PGError) ERROR: column reference "id" is ambiguous
LINE 1: SELECT id FROM "katello_repositories" INNER JOIN "katello_co...
^

... skipped 118 lines
Completed 500 Internal Server Error in 159ms (Views: 0.3ms | ActiveRecord: 0.9ms)

Expected results:
The list of repositories associated with the content view should be presented.

Additional info:

Fixed locally by replacing a single line in:
/opt/rh/ruby193/root/usr/share/gems/gems/katello-2.1.0/app/controllers/katello/api/v2/repositories_controller.rb

options[:filters] = [{:terms => {:id => repositories.pluck(:id)}}]

with:
options[:filters] = [{:terms => {:id => repositories.pluck("#{Katello::Repository.table_name}.id")}}]

Associated revisions

Revision 870b5f40 (diff)
Added by Justin Sherrill over 7 years ago

fixes #8904 - fixing query breaking content view repo list

Revision 041c2419
Added by Justin Sherrill over 7 years ago

Merge pull request #4911 from jlsherrill/8904

fixes #8904 - fixing query breaking content view repo list

History

#1 Updated by Eric Helms over 7 years ago

  • Target version set to 63
  • Difficulty set to easy
  • Triaged changed from No to Yes

#2 Updated by Justin Sherrill over 7 years ago

  • Assignee set to Justin Sherrill
  • Priority changed from High to Urgent

#3 Updated by The Foreman Bot over 7 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/Katello/katello/pull/4911 added
  • Pull request deleted ()

#4 Updated by Justin Sherrill over 7 years ago

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

Also available in: Atom PDF