Bug 861426

Summary: Deleting a non-existent binding returns a 200 instead of a 404
Product: [Retired] Pulp Reporter: Jay Dobies <jason.dobies>
Component: API/integrationAssignee: pulp-bugs
Status: CLOSED CURRENTRELEASE QA Contact: Preethi Thomas <pthomas>
Severity: low Docs Contact:
Priority: low    
Version: MasterCC: ipanova, rbarlow, skarmark
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-11-14 14:37:07 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:

Description Jay Dobies 2012-09-28 15:11:37 UTC
I believe this sort of thing should be a 404 since the resource doesn't exist. Example of where I saw it below.


In [17]: pic.DELETE(unbind_url)
Response Body
null
Out[17]: (200, None)

In [18]: pic.DELETE(unbind_url)
Response Body
null
Out[18]: (200, None)

In [19]: unbind_url
Out[19]: '/v2/consumers/hinterlands/bindings/p3/puppet_distributor/'

Comment 1 Ina Panova 2014-11-14 14:37:07 UTC
Seems to be fixed in 2.4 and 2.5

# pulp-admin -u admin -p admin repo list
+----------------------------------------------------------------------+
                              Repositories
+----------------------------------------------------------------------+

Id:                  m1
Display Name:        m1
Description:         None
Content Unit Counts: 

Id:                  m2
Display Name:        m2
Description:         None
Content Unit Counts: 


# curl -i -H "Accept: application/json" -X DELETE -k -u admin:admin 'https://localhost//pulp/api/v2/consumers/c1/bindings/invalid_repo/yum_distributor/'
HTTP/1.1 404 Not Found
Date: Fri, 14 Nov 2014 14:26:53 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: 570
Content-Type: application/json

{"http_request_method": "DELETE", "exception": null, "error_message": "Missing resource(s): repo_id=invalid_repo, distributor_id=yum_distributor", "_href": "/pulp/api/v2/consumers/c1/bindings/invalid_repo/yum_distributor/", "http_status": 404, "error": {"code": "PLP0009", "data": {"resources": {"repo_id": "invalid_repo", "distributor_id": "yum_distributor"}}, "description": "Missing resource(s): repo_id=invalid_repo, distributor_id=yum_distributor", "sub_errors": []}, "traceback": null, "resources": {"repo_id": "invalid_repo", "distributor_id": "yum_distributor"}}