Project

Profile

Help

Issue #394

closed

Wrong status code for Upload API

Added by igulina@redhat.com about 9 years ago. Updated almost 4 years ago.

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

Description

Description of problem:

Import into a repository operation returns code 200 (aka if the import completed successfully), but response body repots an error.

Version-Release number of selected component (if applicable):
2.3

How reproducible:
always

Steps to Reproduce (first variant):
1. curl -i -H \"Accept: application/json\" -X POST -k -u admin:admin 'https://localhost/pulp/api/v2/content/uploads/'

HTTP/1.1 201 Created
Date: Mon, 03 Feb 2014 12:49:34 GMT
Server: Apache/2.4.6 (Fedora) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5
Location: /pulp/api/v2/content/uploads/b53ff383-8f97-4019-88e7-015af64d5f2f/
Content-Length: 132
Content-Type: application/json

{"upload_id": "b53ff383-8f97-4019-88e7-015af64d5f2f", "_href": "/pulp/api/v2/content/uploads/b53ff383-8f97-4019-88e7-015af64d5f2f/"}[igulina@localhost tests]$

2. curl -i -F name=test -F filedata=@/var/lib/pulp/content/rpm/whale/0.2/1/noarch/3b34234afc8b8931d627f8466f0e4fd352145a2512681ec29db0a051a0c9d893/whale-0.2-1.noarch.rpm -H \"Accept: application/json\" -X PUT -k -u admin:admin 'https://localhost/pulp/api/v2/content/uploads/b53ff383-8f97-4019-88e7-015af64d5f2f/500/'

HTTP/1.1 200 OK
Date: Mon, 03 Feb 2014 12:50:31 GMT
Server: Apache/2.4.6 (Fedora) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5
Content-Length: 4
Content-Type: application/json

3. curl -i -H \"Accept: application/json\" -X POST -k -u admin:admin -d '{"upload_id":"b53ff383-8f97-4019-88e7-015af64d5f2f","unit_type_id":"rpm", "unit_key" : "text.rpm"}' 'https://localhost/pulp/api/v2/repositories/foo/actions/import_upload/'

HTTP/1.1 200 OK
Date: Mon, 03 Feb 2014 12:58:05 GMT
Server: Apache/2.4.6 (Fedora) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5
Content-Length: 95
Content-Type: application/json

{"details": {"errors": ["invalid unit key or metadata"]}, "success_flag": false, "summary": ""}

Steps to Reproduce (second variant):
the same for uuid as "unit_key"

curl -i -H \"Accept: application/json\" -X POST -k -u admin:admin -d '{"upload_id":"b53ff383-8f97-4019-88e7-015af64d5f2f","unit_type_id":"rpm", "unit_key" : "fe28a235-d70a-4103-bb72-b89831d4cbc1"}' 'https://localhost/pulp/api/v2/repositories/foo/actions/import_upload/'

HTTP/1.1 200 OK
Date: Mon, 03 Feb 2014 13:44:07 GMT
Server: Apache/2.4.6 (Fedora) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5
Content-Length: 95
Content-Type: application/json

Expected results:
if "success_flag" is false then it should return error status code

HTTP/1.1 4xx Error

{"details": {"errors": ["invalid unit key or metadata"]}, "success_flag": false, "summary": ""}

Additional info:
Also see bug 1060752

+ This bug was cloned from Bugzilla Bug #1060757 +

Also available in: Atom PDF