Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1163494

Summary: Issuing HTTP GET for non-existent repository triggers HTTP 500
Product: Red Hat Satellite Reporter: jaudet
Component: APIAssignee: Bryan Kearney <bkearney>
Status: CLOSED DUPLICATE QA Contact: Katello QA List <katello-qa-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: NightlyCC: bbuckingham, cwelton
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-11-25 15:59:24 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:
Attachments:
Description Flags
Stack trace showing the error in action. none

Description jaudet 2014-11-12 20:22:28 UTC
Created attachment 956866 [details]
Stack trace showing the error in action.

Description of problem:
Issuing an HTTP GET request for a non-existent repository triggers an HTTP 500 error with this error message:

    NoMethodError: undefined method `[]' for nil:NilClass

This only occurs if a repository with the given ID once existed. Fetching a repository that has never existed will trigger an HTTP 404 as usual with a message like this:

    Couldn't find Katello::Repository with id=600

Version-Release number of selected component (if applicable):
Tested against a nightly version of Foreman Version 1.8.0-develop. The following software is installed:

* apr-util-ldap-1.3.9-3.el6_0.1.x86_64
* candlepin-0.9.34-1.el6.noarch
* candlepin-common-1.0.10-1.el6.noarch
* candlepin-selinux-0.9.34-1.el6.noarch
* candlepin-tomcat6-0.9.34-1.el6.noarch
* elasticsearch-0.90.10-7.el6.noarch
* foreman-1.8.0-0.develop.201411120024gita08897e.el6.noarch
* foreman-compute-1.8.0-0.develop.201411120024gita08897e.el6.noarch
* foreman-gce-1.8.0-0.develop.201411120024gita08897e.el6.noarch
* foreman-libvirt-1.8.0-0.develop.201411120024gita08897e.el6.noarch
* foreman-ovirt-1.8.0-0.develop.201411120024gita08897e.el6.noarch
* foreman-postgresql-1.8.0-0.develop.201411120024gita08897e.el6.noarch
* foreman-proxy-1.8.0-0.develop.201411111731git81c679e.el6.noarch
* foreman-release-1.8.0-0.develop.201411120024gita08897e.el6.noarch
* foreman-selinux-1.8.0-0.develop.201410280941git10de1c5.el6.noarch
* foreman-vmware-1.8.0-0.develop.201411120024gita08897e.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.1.0-1.201411102133git90ee193.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.0-0.7.beta.el6.noarch
* pulp-nodes-parent-2.5.0-0.7.beta.el6.noarch
* pulp-puppet-plugins-2.5.0-0.7.beta.el6.noarch
* pulp-puppet-tools-2.5.0-0.7.beta.el6.noarch
* pulp-rpm-plugins-2.5.0-0.7.beta.el6.noarch
* pulp-selinux-2.5.0-0.7.beta.el6.noarch
* pulp-server-2.5.0-0.7.beta.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.3.1-2.el6.noarch
* ruby193-rubygem-runcible-1.3.0-1.el6.noarch

How reproducible:
100%

Steps to Reproduce:
1. Create a repository. Note its ID.
2. Delete that repository.
3. Fetch it.

Actual results:
HTTP 500

Expected results:
HTTP 404

Additional info:
Attached is a stack trace showing the error.

Comment 1 RHEL Program Management 2014-11-12 20:33:26 UTC
Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

Comment 3 jaudet 2014-11-12 20:51:33 UTC
This is tested. See https://github.com/SatelliteQE/robottelo/pull/1679

Comment 4 jaudet 2014-11-25 15:59:24 UTC
This issue apparently occurs because repository deletion is an asynchronous task that takes a significant amount of time to complete.

*** This bug has been marked as a duplicate of bug 1166365 ***