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 1133071 - Fetching a non-existent system returns HTTP 400 (bad request), not 404 (not found)
Summary: Fetching a non-existent system returns HTTP 400 (bad request), not 404 (not f...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: API
Version: 6.0.6
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: Unspecified
Assignee: Bryan Kearney
QA Contact: Katello QA List
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-08-22 15:33 UTC by jaudet
Modified: 2019-09-26 13:49 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-07-27 08:44:14 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
A traceback from /var/log/foreman/production.log. (25.75 KB, text/plain)
2014-08-22 15:33 UTC, jaudet
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:1500 0 normal SHIPPED_LIVE Red Hat Satellite 6.2 Base Libraries 2016-07-27 12:24:38 UTC

Description jaudet 2014-08-22 15:33:46 UTC
Created attachment 929687 [details]
A traceback from /var/log/foreman/production.log.

Description of problem:
Issuing an HTTP GET request to /katello/api/v2/systems/:uuid returns an HTTP 400 response if the requested system does not exist. This is improper: an HTTP 400 response indicates that the request uses bad syntax. Fetching a non-existent system should return an HTTP 404 error, indicating that a non-existent resource was requested.

Version-Release number of selected component (if applicable):
This behaviour has been tested against qetello02.usersys.redhat.com, which is running Satellite 6.0.4. The following software is installed:

* apr-util-ldap-1.3.9-3.el6_0.1.x86_64
* candlepin-0.9.23-1.el6_5.noarch
* candlepin-common-1.0.1-1.el6_5.noarch
* candlepin-scl-1-5.el6_4.noarch
* candlepin-scl-quartz-2.1.5-5.el6_4.noarch
* candlepin-scl-rhino-1.7R3-1.el6_4.noarch
* candlepin-scl-runtime-1-5.el6_4.noarch
* candlepin-selinux-0.9.23-1.el6_5.noarch
* candlepin-tomcat6-0.9.23-1.el6_5.noarch
* elasticsearch-0.90.10-6.el6sat.noarch
* foreman-1.6.0.40-1.el6sat.noarch
* foreman-compute-1.6.0.40-1.el6sat.noarch
* foreman-gce-1.6.0.40-1.el6sat.noarch
* foreman-libvirt-1.6.0.40-1.el6sat.noarch
* foreman-ovirt-1.6.0.40-1.el6sat.noarch
* foreman-postgresql-1.6.0.40-1.el6sat.noarch
* foreman-proxy-1.6.0.28-1.el6sat.noarch
* foreman-selinux-1.6.0.9-1.el6sat.noarch
* foreman-vmware-1.6.0.40-1.el6sat.noarch
* katello-1.5.0-28.el6sat.noarch
* katello-ca-1.0-1.noarch
* katello-certs-tools-1.5.6-1.el6sat.noarch
* katello-installer-0.0.59-1.el6sat.noarch
* openldap-2.4.23-32.el6_4.1.x86_64
* pulp-katello-0.3-3.el6sat.noarch
* pulp-nodes-common-2.4.0-0.30.beta.el6sat.noarch
* pulp-nodes-parent-2.4.0-0.30.beta.el6sat.noarch
* pulp-puppet-plugins-2.4.0-0.30.beta.el6sat.noarch
* pulp-puppet-tools-2.4.0-0.30.beta.el6sat.noarch
* pulp-rpm-plugins-2.4.0-0.30.beta.el6sat.noarch
* pulp-selinux-2.4.0-0.30.beta.el6sat.noarch
* pulp-server-2.4.0-0.30.beta.el6sat.noarch
* python-ldap-2.3.10-1.el6.x86_64
* ruby193-rubygem-net-ldap-0.3.1-3.el6sat.noarch
* ruby193-rubygem-runcible-1.1.0-2.el6sat.noarch

How reproducible:
100%

Steps to Reproduce:
1. Issue an HTTP GET to /katello/api/v2/systems/:uuid, where the requested system does not exist.

Actual results:
An HTTP 400 response.

Expected results:
An HTTP 404 response.

Additional info:
This is an example of the message attached to one of the HTTP 400 error messages received:

    {
        u'displayMessage':
            u'Katello::Resources::Candlepin::Consumer: 404 Resource Not Found
            {"displayMessage":"Consumer with id abc123 could not be
            found.","requestUuid":"5d0f64df-e373-4273-b00e-6f1977bc3865"} (GET
            /candlepin/consumers/abc123)',
        u'errors': [
            u'Katello::Resources::Candlepin::Consumer: 404 Resource Not Found
            {"displayMessage":"Consumer with id abc123 could not be
            found.","requestUuid":"5d0f64df-e373-4273-b00e-6f1977bc3865"} (GET
            /candlepin/consumers/abc123)'
        ]
    }

Comment 2 jaudet 2014-08-22 15:48:19 UTC
A test has been created which targets this bug. See here: https://github.com/omaciel/robottelo/blob/master/tests/foreman/api/test_system_v2.py#L71-L101

Comment 3 Justin Sherrill 2016-02-25 18:03:14 UTC
The /systems api is deprecated in favor of the /hosts api.  Satellite 6.2 embraces this in a big way by adding content and subscription attributes to the /hosts api and I have confirmed that this returns a 404 properly.

Moving this to POST to be tested against the /hsots api

Comment 7 errata-xmlrpc 2016-07-27 08:44:14 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/RHBA-2016:1500


Note You need to log in before you can comment on or make changes to this bug.