Project

Profile

Help

Issue #406

closed

Update importer of unexistant repo should return 404

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

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

Description

Description of problem:
https://pulp-dev-guide.readthedocs.org/en/latest/integration/rest-api/repo/cud.html#update-an-importer-associated-with-a-repository

Docs say that an importer associated to a repo can be updated, but in case if there is no repository or importer with the specified IDs it will return 404.
Current api in this case returns a call report with 202 response code and the error is visible only in the task information.

  1. curl -i -H "Accept: application/json" -X PUT -k -u admin:admin -d '{"importer_config":{"num_units":5}}' 'https://ec2-54-217-78-7.eu-west-1.compute.amazonaws.com/pulp/api/v2/repositories/unexistant_repo/importers/yum_importer/'
    HTTP/1.1 202 Accepted
    Date: Thu, 20 Mar 2014 11:16:47 GMT
    Server: Apache/2.4.6 (Fedora) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5
    Content-Encoding: utf-8
    Content-Length: 172
    Content-Type: application/json

{"spawned_tasks": [{"_href": "/pulp/api/v2/tasks/93ea7f3d-347a-4fed-ba7d-dd71db83396b/", "task_id": "93ea7f3d-347a-4fed-ba7d-dd71db83396b"}], "result": null, "error": null}

]# curl H "Accept: application/json" -X GET -k -u admin:admin 'https://ec2-54-217-78-7.eu-west-1.compute.amazonaws.com/pulp/api/v2/tasks/93ea7f3d-347a-4fed-ba7d-dd71db83396b/'|python -m json.tool
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1324 100 1324 0 0 5281 0 -
:--:-- --:--:-- --:--:-- 5296
{
"_href": "/pulp/api/v2/tasks/93ea7f3d-347a-4fed-ba7d-dd71db83396b/",
"_id": {
"$oid": "532ace1f6380d1e4b56c74b0"
},
"_ns": "task_status",
"error": {
"code": "PLP0009",
"data": {
"resources": {
"resource_id": "unexistant_repo"
}
},
"description": "Missing resource(s): resource_id=unexistant_repo",
"sub_errors": []
},
"finish_time": 1395314207,
"queue": "",
"start_time": 1395314207,
"state": "error",
"tags": [
"pulp:repository:unexistant_repo",
"pulp:repository_importer:yum_importer",
"pulp:action:update_importer"
],
"task_id": "93ea7f3d-347a-4fed-ba7d-dd71db83396b",
"traceback": "Traceback (most recent call last):\n File \"/usr/lib/python2.7/site-packages/celery/app/trace.py\", line 238, in trace_task\n R = retval = fun(*args, **kwargs)\n File \"/usr/lib/python2.7/site-packages/pulp/server/async/tasks.py\", line 369, in call\n return super(Task, self).__call__(*args, **kwargs)\n File \"/usr/lib/python2.7/site-packages/celery/app/trace.py\", line 416, in protected_call\n return self.run(*args, **kwargs)\n File \"/usr/lib/python2.7/site-packages/pulp/server/managers/repo/importer.py\", line 237, in update_importer_config\n raise MissingResource(repo_id)\nMissingResource: Missing resource(s): resource_id=unexistant_repo\n"
}

This behaviour is a bit confusing and maybe it would be better if the update call will directly return 404 like in case with distributor update call:

  1. curl -i -H "Accept: application/json" -X PUT -k -u admin:admin -d '{ "distributor_config":{"relative_url":"yyy"}}' 'https://example.com/pulp/api/v2/repositories/unexistant_repo/distributors/yum_distributor/'
    HTTP/1.1 404 Not Found
    Date: Thu, 20 Mar 2014 11:21:30 GMT
    Server: Apache/2.4.6 (Fedora) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5
    Content-Encoding: utf-8
    Content-Length: 464
    Content-Type: application/json
    {
    "_href": "/pulp/api/v2/repositories/unexistant_repo/distributors/yum_distributor/",
    "error": {
    "code": "PLP0009",
    "data": {
    "resources": {
    "distributor": "yum_distributor"
    }
    },
    "description": "Missing resource(s): distributor=yum_distributor",
    "sub_errors": []
    },
    "error_message": "Missing resource(s): distributor=yum_distributor",
    "exception": null,
    "http_request_method": "PUT",
    "http_status": 404,
    "resources": {
    "distributor": "yum_distributor"
    },
    "traceback": null
    }

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

pulp-server-2.4.0-0.3.alpha.git.13.3215df6.fc20.noarch
How reproducible:
always

Steps to Reproduce:
1. update unexistant importer(or update importer of unexistant repo)
2.
3.

Actual results:

Expected results:

Additional info:

+ This bug was cloned from Bugzilla Bug #1078833 +

Also available in: Atom PDF