Project

General

Profile

Actions

Bug #8904

closed

Error when selecting repositories of a specific content view

Added by Moti Asayag over 9 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Urgent
Category:
Content Views
Target version:
Difficulty:
easy
Triaged:
Yes
Fixed in Releases:
Found in Releases:

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")}}]

Actions #1

Updated by Eric Helms over 9 years ago

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

Updated by Justin Sherrill over 9 years ago

  • Assignee set to Justin Sherrill
  • Priority changed from High to Urgent
Actions #3

Updated by The Foreman Bot over 9 years ago

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

Updated by Justin Sherrill over 9 years ago

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

Also available in: Atom PDF