Bug 1111297 - no error status code when retrieved event listener with a given id does not exist
Summary: no error status code when retrieved event listener with a given id does not e...
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Pulp
Classification: Retired
Component: API/integration
Version: 2.4 Beta
Hardware: Unspecified
OS: Unspecified
medium
unspecified
Target Milestone: ---
: ---
Assignee: pulp-bugs
QA Contact: Irina Gulina
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-06-19 16:35 UTC by Irina Gulina
Modified: 2015-02-28 22:11 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-02-28 22:11:05 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Pulp Redmine 457 0 None None None Never

Description Irina Gulina 2014-06-19 16:35:40 UTC
Description of problem:


Version-Release number of selected component (if applicable):
rpm -qa pulp-server
pulp-server-2.4.0-0.20.beta.el6.noarch

How reproducible:
always

Steps to Reproduce:
>>curl -k -X GET https://admin:admin@localhost/pulp/api/v2/events/                                                                                   
[]

>> curl -k -X GET https://admin:admin@localhost/pulp/api/v2/events/53a2efa1b7e943519470c186/

{"http_request_method": "GET", "exception": null, "error_message": "Missing resource(s): event_listener=53a2efa1b7e943519470c186", "_href": "/pulp/api/v2/events/53a2efa1b7e943519470c186/", "http_status": 404, "error": {"code": "PLP0009", "data": {"resources": {"event_listener": "53a2efa1b7e943519470c186"}}, "description": "Missing resource(s): event_listener=53a2efa1b7e943519470c186", "sub_errors": []}, "traceback": null, "resources": {"event_listener": "53a2efa1b7e943519470c186"}}



Expected results:


HTTP/1.1 404 Not Found
Date: Thu, 19 Jun 2014 14:30:34 GMT
Server: Apache/2.2.15 (Red Hat)
Content-Length: 9
Connection: close
Content-Type: text/html; charset=UTF-8

not found

Comment 1 Barnaby Court 2014-06-24 19:56:49 UTC
This is returning a 404.  It is returning more data in addition to the 404 but the HTTP error code is being returned properly.

Comment 2 Jeremy Cline 2014-08-07 15:46:41 UTC
I've untriaged this after a discussion with Barnaby. We aren't terribly consistent about what we return when a 404 occurs, so we need to decide what the correct response is and be consistent with that decision. Below are two possible results for a 404.

This is the output for a missing event listener:

curl -i -H "Accept: application/json" -X GET -u admin:admin -k 'https://localhost/pulp/api/v2/events/notanevent/'
HTTP/1.1 404 Not Found
Date: Thu, 07 Aug 2014 13:10:17 GMT
Server: Apache/2.4.10 (Fedora) OpenSSL/1.0.1e-fips mod_wsgi/3.5 Python/2.7.5
Content-Encoding: utf-8
Content-Length: 416
Content-Type: application/json

{
    "_href": "/pulp/api/v2/events/notanevent/",
    "error": {
        "code": "PLP0009",
        "data": {
            "resources": {
                "event_listener": "notanevent"
            }
        },
        "description": "Missing resource(s): event_listener=notanevent",
        "sub_errors": []
    },
    "error_message": "Missing resource(s): event_listener=notanevent",
    "exception": null,
    "http_request_method": "GET",
    "http_status": 404,
    "resources": {
        "event_listener": "notanevent"
    },
    "traceback": null
}


This is the same output you'll see from /pulp/api/v2/repositories/notarepository/ or /pulp/api/v2/consumers/notaconsumer/

This is the output from retrieving the schedules for a consumer that doesn't exist:

curl -i -H "Accept: application/json" -X GET -u admin:admin -k 'https://localhost/pulp/api/v2/consumers/notaconsumer/schedules/'
HTTP/1.1 404 Not Found
Date: Thu, 07 Aug 2014 15:43:54 GMT
Server: Apache/2.4.10 (Fedora) OpenSSL/1.0.1e-fips mod_wsgi/3.5 Python/2.7.5
Content-Length: 9
Content-Type: text/html; charset=UTF-8

not found

Comment 3 Brian Bouterse 2015-02-28 22:11:05 UTC
Moved to https://pulp.plan.io/issues/457


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