Bug 1187480

Summary: Searching applicable errata by package_name throwing internal server error on UI and PGError in production.log
Product: Red Hat Satellite Reporter: Sachin Ghai <sghai>
Component: WebUIAssignee: Justin Sherrill <jsherril>
WebUI sub component: Katello QA Contact: sthirugn <sthirugn>
Status: CLOSED ERRATA Docs Contact:
Severity: high    
Priority: unspecified CC: bbuckingham, jmontleo, sthirugn
Version: NightlyKeywords: Triaged
Target Milestone: Unspecified   
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-12 05:22:50 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1130651, 1188301    
Attachments:
Description Flags
500 internal server error raised in firebug
none
complete logs from production.log none

Description Sachin Ghai 2015-01-30 07:32:16 UTC
Created attachment 985875 [details]
500 internal server error raised in firebug

Description of problem:
while searching applicable errata by package_name throwing 500 Internal server error in firebug and PGError on production.log


from production.log:
=====================
Processing by Katello::Api::V2::ErrataController#index as JSON
  Parameters: {"errata_restrict_applicable"=>"true", "organization_id"=>"1", "page"=>"1", "paged"=>"true", "repository_id"=>"4", "search"=>"  package_name = zsh", "sort_by"=>"updated", "sort_order"=>"DESC", "api_version"=>"v2"}
  Rendered /opt/rh/ruby193/root/usr/share/gems/gems/katello-2.2.0/app/views/katello/api/v2/errata/index.json.rabl within katello/api/v2/layouts/collection (7.5ms)
ActiveRecord::StatementInvalid: PGError: ERROR:  syntax error at or near "DISTINCT"
LINE 1: SELECT  DISTINCT DISTINCT "katello_errata".id, katello_errat...
                         ^
: SELECT  DISTINCT DISTINCT "katello_errata".id, katello_errata.updated AS alias_0 FROM "katello_errata" INNER JOIN "katello_repository_errata" ON "katello_repository_errata"."erratum_id" = "katello_errata"."id" INNER JOIN "katello_system_errata" ON "katello_system_errata"."erratum_id" = "katello_errata"."id" LEFT OUTER JOIN "katello_erratum_packages" ON "katello_erratum_packages"."erratum_id" = "katello_errata"."id" WHERE "katello_repository_errata"."repository_id" IN (SELECT "katello_repositories"."id" FROM "katello_repositories"  WHERE "katello_repositories"."product_id" IN (SELECT "katello_products"."id" FROM "katello_products" ) AND "katello_repositories"."environment_id" IN (4, 3, 2, 1) ORDER BY katello_repositories.name ASC) AND "katello_system_errata"."system_id" IN (SELECT "katello_systems"."id" FROM "katello_systems" ) AND (("katello_errata"."id" IN (SELECT "erratum_id" FROM "katello_erratum_packages" WHERE "katello_erratum_packages"."name" = 'zsh' ))) ORDER BY katello_errata.updated DESC LIMIT 20 OFFSET 0



Version-Release number of selected component (if applicable):
* apr-util-ldap-1.3.9-3.el6_0.1.x86_64
* candlepin-0.9.38-1.el6.noarch
* candlepin-common-1.0.18-1.el6.noarch
* candlepin-selinux-0.9.38-1.el6.noarch
* candlepin-tomcat6-0.9.38-1.el6.noarch
* elasticsearch-0.90.10-7.el6.noarch
* foreman-1.8.0-0.develop.201501270025gite86494a.el6.noarch
* foreman-compute-1.8.0-0.develop.201501270025gite86494a.el6.noarch
* foreman-gce-1.8.0-0.develop.201501270025gite86494a.el6.noarch
* foreman-libvirt-1.8.0-0.develop.201501270025gite86494a.el6.noarch
* foreman-ovirt-1.8.0-0.develop.201501270025gite86494a.el6.noarch
* foreman-postgresql-1.8.0-0.develop.201501270025gite86494a.el6.noarch
* foreman-proxy-1.8.0-0.develop.201501261316git9ea2ac7.el6.noarch
* foreman-release-1.8.0-0.develop.201501270025gite86494a.el6.noarch
* foreman-selinux-1.8.0-0.develop.201412151103gite2863e4.el6.noarch
* foreman-vmware-1.8.0-0.develop.201501270025gite86494a.el6.noarch
* katello-2.1.0-1.201411061509gitb0b8f43.el6.noarch
* katello-certs-tools-2.0.1-1.el6.noarch
* katello-default-ca-1.0-1.noarch
* katello-installer-2.2.0-1.201501230914git3dbe606.el6.noarch
* katello-installer-base-2.2.0-1.201501230914git3dbe606.el6.noarch
* katello-repos-2.1.1-1.el6.noarch
* katello-server-ca-1.0-1.noarch
* openldap-2.4.39-8.el6.x86_64
* pulp-docker-plugins-0.2.1-0.2.beta.el6.noarch
* pulp-katello-0.3-3.el6.noarch
* pulp-nodes-common-2.5.1-1.el6.noarch
* pulp-nodes-parent-2.5.1-1.el6.noarch
* pulp-puppet-plugins-2.5.1-1.el6.noarch
* pulp-puppet-tools-2.5.1-1.el6.noarch
* pulp-rpm-plugins-2.5.1-1.el6.noarch
* pulp-selinux-2.5.1-1.el6.noarch
* pulp-server-2.5.1-1.el6.noarch
* python-ldap-2.3.10-1.el6.x86_64
* ruby193-rubygem-ldap_fluff-0.3.3-1.el6.noarch
* ruby193-rubygem-net-ldap-0.10.0-1.el6.noarch
* ruby193-rubygem-runcible-1.3.0-1.el6.noarch
* rubygem-hammer_cli-0.1.4-1.201501260908gitf44b8c5.el6.noarch
* rubygem-hammer_cli_foreman-0.1.4-1.201501221305git706b057.el6.noarch
* rubygem-hammer_cli_foreman_bootdisk-0.1.2-1.el6.noarch
*

How reproducible:
always

Steps to Reproduce:
1. Go to Errata page, make sure org is selected
2. select the repo from dropdown
3. Select Applicable check-box
4. search the "package_name = zsh"
Make sure firebug is open 

Actual results:


Expected results:
firebug:
=======
"NetworkError: 500 Internal Server Error - https://dhcp201-185.englab.pnq.redhat.com/katello/api/v2/errata?errata_restrict_applicable=true&organization_id=1&page=1&paged=true&repository_id=4&search=++package_name+%3D+zsh&sort_by=updated&sort_order=DESC"


production.log:
================

from production.log:
=====================
Processing by Katello::Api::V2::ErrataController#index as JSON
  Parameters: {"errata_restrict_applicable"=>"true", "organization_id"=>"1", "page"=>"1", "paged"=>"true", "repository_id"=>"4", "search"=>"  package_name = zsh", "sort_by"=>"updated", "sort_order"=>"DESC", "api_version"=>"v2"}
  Rendered /opt/rh/ruby193/root/usr/share/gems/gems/katello-2.2.0/app/views/katello/api/v2/errata/index.json.rabl within katello/api/v2/layouts/collection (7.5ms)
ActiveRecord::StatementInvalid: PGError: ERROR:  syntax error at or near "DISTINCT"
LINE 1: SELECT  DISTINCT DISTINCT "katello_errata".id, katello_errat...
                         ^
: SELECT  DISTINCT DISTINCT "katello_errata".id, katello_errata.updated AS alias_0 FROM "katello_errata" INNER JOIN "katello_repository_errata" ON "katello_repository_errata"."erratum_id" = "katello_errata"."id" INNER JOIN "katello_system_errata" ON "katello_system_errata"."erratum_id" = "katello_errata"."id" LEFT OUTER JOIN "katello_erratum_packages" ON "katello_erratum_packages"."erratum_id" = "katello_errata"."id" WHERE "katello_repository_errata"."repository_id" IN (SELECT "katello_repositories"."id" FROM "katello_repositories"  WHERE "katello_repositories"."product_id" IN (SELECT "katello_products"."id" FROM "katello_products" ) AND "katello_repositories"."environment_id" IN (4, 3, 2, 1) ORDER BY katello_repositories.name ASC) AND "katello_system_errata"."system_id" IN (SELECT "katello_systems"."id" FROM "katello_systems" ) AND (("katello_errata"."id" IN (SELECT "erratum_id" FROM "katello_erratum_packages" WHERE "katello_erratum_packages"."name" = 'zsh' ))) ORDER BY katello_errata.updated DESC LIMIT 20 OFFSET 0



Version-Release number of selected component (if applicable):
* apr-util-ldap-1.3.9-3.el6_0.1.x86_64
* candlepin-0.9.38-1.el6.noarch
* candlepin-common-1.0.18-1.el6.noarch
* candlepin-selinux-0.9.38-1.el6.noarch
* candlepin-tomcat6-0.9.38-1.el6.noarch
* elasticsearch-0.90.10-7.el6.noarch
* foreman-1.8.0-0.develop.201501270025gite86494a.el6.noarch
* foreman-compute-1.8.0-0.develop.201501270025gite86494a.el6.noarch
* foreman-gce-1.8.0-0.develop.201501270025gite86494a.el6.noarch
* foreman-libvirt-1.8.0-0.develop.201501270025gite86494a.el6.noarch
* foreman-ovirt-1.8.0-0.develop.201501270025gite86494a.el6.noarch
* foreman-postgresql-1.8.0-0.develop.201501270025gite86494a.el6.noarch
* foreman-proxy-1.8.0-0.develop.201501261316git9ea2ac7.el6.noarch
* foreman-release-1.8.0-0.develop.201501270025gite86494a.el6.noarch
* foreman-selinux-1.8.0-0.develop.201412151103gite2863e4.el6.noarch
* foreman-vmware-1.8.0-0.develop.201501270025gite86494a.el6.noarch
* katello-2.1.0-1.201411061509gitb0b8f43.el6.noarch
* katello-certs-tools-2.0.1-1.el6.noarch
* katello-default-ca-1.0-1.noarch
* katello-installer-2.2.0-1.201501230914git3dbe606.el6.noarch
* katello-installer-base-2.2.0-1.201501230914git3dbe606.el6.noarch
* katello-repos-2.1.1-1.el6.noarch
* katello-server-ca-1.0-1.noarch
* openldap-2.4.39-8.el6.x86_64
* pulp-docker-plugins-0.2.1-0.2.beta.el6.noarch
* pulp-katello-0.3-3.el6.noarch
* pulp-nodes-common-2.5.1-1.el6.noarch
* pulp-nodes-parent-2.5.1-1.el6.noarch
* pulp-puppet-plugins-2.5.1-1.el6.noarch
* pulp-puppet-tools-2.5.1-1.el6.noarch
* pulp-rpm-plugins-2.5.1-1.el6.noarch
* pulp-selinux-2.5.1-1.el6.noarch
* pulp-server-2.5.1-1.el6.noarch
* python-ldap-2.3.10-1.el6.x86_64
* ruby193-rubygem-ldap_fluff-0.3.3-1.el6.noarch
* ruby193-rubygem-net-ldap-0.10.0-1.el6.noarch
* ruby193-rubygem-runcible-1.3.0-1.el6.noarch
* rubygem-hammer_cli-0.1.4-1.201501260908gitf44b8c5.el6.noarch
* rubygem-hammer_cli_foreman-0.1.4-1.201501221305git706b057.el6.noarch
* rubygem-hammer_cli_foreman_bootdisk-0.1.2-1.el6.noarch
*

Additional info:

Comment 1 Sachin Ghai 2015-01-30 07:34:42 UTC
Created attachment 985876 [details]
complete logs from production.log

Comment 3 Justin Sherrill 2015-02-18 20:47:03 UTC
resolved as part of https://bugzilla.redhat.com/show_bug.cgi?id=1179462

but on a different page, so moving to on-qa

Comment 4 sthirugn@redhat.com 2015-03-03 21:16:18 UTC
Failed

Satellite-6.1.0-RHEL-6-20150224.0

Comment 5 Justin Sherrill 2015-03-06 17:47:43 UTC
This will be fixed by https://bugzilla.redhat.com/show_bug.cgi?id=1198363

Moving to POST.  No additional cherrypick needed.

Comment 8 sthirugn@redhat.com 2015-03-17 20:59:54 UTC
Verified in Satellite-6.1.0-RHEL-6-20150311.1. I am able to search the package names in errata page.

Comment 9 Bryan Kearney 2015-08-11 13:23:14 UTC
This bug is slated to be released with Satellite 6.1.

Comment 10 errata-xmlrpc 2015-08-12 05:22:50 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2015:1592