Project

Profile

Help

Issue #324

200 is not returned if profile does not exist during profile retrieval

Added by ipanova@redhat.com over 6 years ago. Updated over 2 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
1. Low
Version:
Platform Release:
2.7.0
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Documentation, Pulp 2
Sprint:
Quarter:

Description

http://pulp.readthedocs.org/en/latest/dev-guide/integration/rest-api/consumer/profile.html#retrieve-a-profile-by-content-type

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"}}}

History

#1 Updated by ipanova@redhat.com over 6 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to ipanova@redhat.com

#2 Updated by bmbouter over 6 years ago

  • Triaged changed from No to Yes
  • Severity set to Low

#3 Updated by ipanova@redhat.com over 6 years ago

  • Status changed from ASSIGNED to POST

#4 Updated by bmbouter over 6 years ago

  • Category deleted (1)
  • Tags Documentation added

Documentation is now a Tag not a Category.

#5 Updated by bmbouter over 6 years ago

  • Severity changed from Low to 1. Low

#6 Updated by ipanova@redhat.com over 6 years ago

  • Status changed from POST to MODIFIED

#7 Updated by dkliban@redhat.com over 6 years ago

  • Platform Release set to 2.7.0

#8 Updated by dkliban@redhat.com over 6 years ago

  • Status changed from MODIFIED to 5

#9 Updated by igulina@redhat.com over 6 years ago

  • Status changed from 5 to 6

Docs updated [1]

[1] https://github.com/pulp/pulp/blob/master/docs/dev-guide/integration/rest-api/consumer/profile.rst#retrieve-a-profile-by-content-type

>> 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"}}}

#10 Updated by amacdona@redhat.com almost 6 years ago

  • Status changed from 6 to CLOSED - CURRENTRELEASE

#12 Updated by bmbouter over 2 years ago

  • Tags Pulp 2 added

Please register to edit this issue

Also available in: Atom PDF