Issue #324
closed200 is not returned if profile does not exist during profile retrieval
Description
Should be removed:
200 - regardless of whether any profiles exist
And replaced with:
200 - if profile exists
$ curl -i -H "Accept: application/json" -H "WebFrameworkSwitch: webpy" -X POST -k -u admin:admin -d '{"content_type":"mytype", "profile":[]}' "https://localhost/pulp/api/v2/consumers/myconsumer/profiles/"
HTTP/1.1 201 Created
Date: Thu, 26 Feb 2015 13:50:55 GMT
Server: Apache/2.4.10 (Fedora) OpenSSL/1.0.1e-fips mod_wsgi/3.5 Python/2.7.5
Location: /pulp/api/v2/consumers/myconsumer/profiles/myconsumer/mytype/
Content-Length: 340
Content-Type: application/json
{"profile": [], "_href": "/pulp/api/v2/consumers/myconsumer/profiles/myconsumer/mytype/", "_ns": "consumer_unit_profiles", "profile_hash": "4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945", "consumer_id": "myconsumer", "content_type": "mytype", "_id": {"$oid": "54ef24bf45ef4809c5f6785d"}, "id": "54ef24bf45ef4809c5f6785d"}
[ipanova@ina pulp]$
[ipanova@ina pulp]$ curl -i -H "Accept: application/json" -H "WebFrameworkSwitch: django" -X GET -k -u admin:admin "https://localhost/pulp/api/v2/consumers/myconsumer/profiles/mytype/"HTTP/1.1 200 OK
Date: Thu, 26 Feb 2015 13:51:05 GMT
Server: Apache/2.4.10 (Fedora) OpenSSL/1.0.1e-fips mod_wsgi/3.5 Python/2.7.5
Content-Length: 329
Content-Type: application/json
{"profile": [], "_href": "/pulp/api/v2/consumers/myconsumer/profiles/mytype/", "_ns": "consumer_unit_profiles", "profile_hash": "4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945", "consumer_id": "myconsumer", "content_type": "mytype", "_id": {"$oid": "54ef24bf45ef4809c5f6785d"}, "id": "54ef24bf45ef4809c5f6785d"}
[ipanova@ina pulp]$
[ipanova@ina pulp]$ curl -i -H "Accept: application/json" -H "WebFrameworkSwitch: django" -X DELETE -k -u admin:admin "https://localhost/pulp/api/v2/consumers/myconsumer/profiles/mytype/"
HTTP/1.1 200 OK
Date: Thu, 26 Feb 2015 13:51:14 GMT
Server: Apache/2.4.10 (Fedora) OpenSSL/1.0.1e-fips mod_wsgi/3.5 Python/2.7.5
Content-Length: 4
Content-Type: application/json
null
$ curl -i -H "Accept: application/json" -H "WebFrameworkSwitch: django" -X GET -k -u admin:admin "https://localhost/pulp/api/v2/consumers/myconsumer/profiles/mytype/"
HTTP/1.1 404 NOT FOUND
Date: Thu, 26 Feb 2015 13:51:16 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: 599
Content-Type: application/json
{"http_request_method": "GET", "exception": null, "error_message": "Missing resource(s): profile_id={'content_type': u'mytype', 'consumer_id': u'myconsumer'}", "_href": "/pulp/api/v2/consumers/myconsumer/profiles/mytype/", "http_status": 404, "error": {"code": "PLP0009", "data": {"resources": {"profile_id": {"content_type": "mytype", "consumer_id": "myconsumer"}}}, "description": "Missing resource(s): profile_id={'content_type': u'mytype', 'consumer_id': u'myconsumer'}", "sub_errors": []}, "traceback": null, "resources": {"profile_id": {"content_type": "mytype", "consumer_id": "myconsumer"}}}
Updated by ipanova@redhat.com about 9 years ago
- Status changed from NEW to ASSIGNED
- Assignee set to ipanova@redhat.com
Updated by bmbouter about 9 years ago
- Triaged changed from No to Yes
- Severity set to Low
Updated by ipanova@redhat.com about 9 years ago
- Status changed from ASSIGNED to POST
Updated by bmbouter about 9 years ago
- Category deleted (
1) - Tags Documentation added
Documentation is now a Tag not a Category.
Updated by ipanova@redhat.com about 9 years ago
- Status changed from POST to MODIFIED
Updated by dkliban@redhat.com almost 9 years ago
- Status changed from MODIFIED to 5
Updated by igulina@redhat.com almost 9 years ago
- Status changed from 5 to 6
Docs updated [1]
>> curl -i -H "Accept: application/json" -H "WebFrameworkSwitch: webpy" -X POST -k -u admin:admin -d '{"content_type":"mytype", "profile":[]}' "https://localhost/pulp/api/v2/consumers/gosha/profiles/"
HTTP/1.1 201 CREATED
Date: Fri, 26 Jun 2015 14:50:03 GMT
Server: Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5
Content-Length: 319
Location: https://localhost/pulp/api/v2/consumers/gosha/profiles/mytype/
Content-Type: application/json
{"profile": [], "_href": "/pulp/api/v2/consumers/gosha/profiles/mytype/", "_ns": "consumer_unit_profiles", "profile_hash": "4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945", "consumer_id": "gosha", "content_type": "mytype", "_id": {"$oid": "558d669be512ed777daefd1a"}, "id": "558d669be512ed777daefd1a"}
>> curl -i -H "Accept: application/json" -H "WebFrameworkSwitch: django" -X GET -k -u admin:admin "https://localhost/pulp/api/v2/consumers/gosha/profiles/mytype/"
HTTP/1.1 200 OK
Date: Fri, 26 Jun 2015 14:50:30 GMT
Server: Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5
Content-Length: 319
Content-Type: application/json
{"profile": [], "_href": "/pulp/api/v2/consumers/gosha/profiles/mytype/", "_ns": "consumer_unit_profiles", "profile_hash": "4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945", "consumer_id": "gosha", "content_type": "mytype", "_id": {"$oid": "558d669be512ed777daefd1a"}, "id": "558d669be512ed777daefd1a"}[
>> curl -i -H "Accept: application/json" -H "WebFrameworkSwitch: django" -X DELETE -k -u admin:admin "https://localhost/pulp/api/v2/consumers/gosha/profiles/mytype/"
HTTP/1.1 200 OK
Date: Fri, 26 Jun 2015 14:50:59 GMT
Server: Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5
Content-Length: 4
Content-Type: application/json
null
>> curl -i -H "Accept: application/json" -H "WebFrameworkSwitch: django" -X GET -k -u admin:admin "https://localhost/pulp/api/v2/consumers/gosha/profiles/mytype/"
HTTP/1.1 404 NOT FOUND
Date: Fri, 26 Jun 2015 14:51:16 GMT
Server: Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5
Content-Encoding: utf-8
Content-Length: 574
Content-Type: application/json
{"http_request_method": "GET", "exception": null, "error_message": "Missing resource(s): profile_id={'content_type': u'mytype', 'consumer_id': u'gosha'}", "_href": "/pulp/api/v2/consumers/gosha/profiles/mytype/", "http_status": 404, "error": {"code": "PLP0009", "data": {"resources": {"profile_id": {"content_type": "mytype", "consumer_id": "gosha"}}}, "description": "Missing resource(s): profile_id={'content_type': u'mytype', 'consumer_id': u'gosha'}", "sub_errors": []}, "traceback": null, "resources": {"profile_id": {"content_type": "mytype", "consumer_id": "gosha"}}}
>> curl -i -H "Accept: application/json" -H "WebFrameworkSwitch: django" -X GET -k -u admin:admin "https://localhost/pulp/api/v2/consumers/no_such_consumer/profiles/mytype/"
HTTP/1.1 404 NOT FOUND
Date: Fri, 26 Jun 2015 14:54:40 GMT
Server: Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5
Content-Encoding: utf-8
Content-Length: 629
Content-Type: application/json
{"http_request_method": "GET", "exception": null, "error_message": "Missing resource(s): profile_id={'content_type': u'mytype', 'consumer_id': u'no_such_consumer'}", "_href": "/pulp/api/v2/consumers/no_such_consumer/profiles/mytype/", "http_status": 404, "error": {"code": "PLP0009", "data": {"resources": {"profile_id": {"content_type": "mytype", "consumer_id": "no_such_consumer"}}}, "description": "Missing resource(s): profile_id={'content_type': u'mytype', 'consumer_id': u'no_such_consumer'}", "sub_errors": []}, "traceback": null, "resources": {"profile_id": {"content_type": "mytype", "consumer_id": "no_such_consumer"}}}
Updated by amacdona@redhat.com over 8 years ago
- Status changed from 6 to CLOSED - CURRENTRELEASE