Bug 1084064
| Summary: | Association of importer with invalid importer type should return 400 | ||
|---|---|---|---|
| Product: | [Retired] Pulp | Reporter: | Ina Panova <ipanova> |
| Component: | API/integration | Assignee: | Jeremy Cline <jcline> |
| Status: | CLOSED UPSTREAM | QA Contact: | pulp-qe-list |
| Severity: | unspecified | Docs Contact: | |
| Priority: | medium | ||
| Version: | unspecified | CC: | jcline, mkovacik, skarmark |
| Target Milestone: | --- | Keywords: | Triaged |
| Target Release: | 2.6.1 | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2015-02-28 22:04:34 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: | |||
Sorry, got confused - in this case it should return 400 Taken from docs: "400 - if one or more of the required parameters is missing, the importer type ID refers to a non-existent importer, or the importer indicates the supplied configuration is invalid" https://github.com/pulp/pulp/pull/1423 This PR fixes several issues: 1. curl -H "Accept: application/json" -X POST -k -u admin:admin -d '{"importer_type_id": "bees", "importer_config":{}}' 'https://localhost/pulp/api/v2/repositories/notarepo/importers/' | python -m json.tool should now result in a 404 (assuming you don't have a repo called notarepo). 2. curl -H "Accept: application/json" -X POST -k -u admin:admin -d '{"importer_type_id": "bees", "importer_config":{}}' 'https://localhost/pulp/api/v2/repositories/beads/importers/' | python -m json.tool should result in a 400 (assuming you do have a repository called beads and there isn't an importer with the id bees). 3. curl -H "Accept: application/json" -X POST -k -u admin:admin -d '{"importer_type_id": "yum_importer", "importer_config":{"max_speed": -2}}' 'https://localhost/pulp/api/v2/repositories/beads/importers/' | python -m json.tool should result in a 400 assuming the yum importer is installed an a repo called beads exists. Previously they all resulted in 202. This was merged into 2.6-dev, which I *believe* maps to 2.6.1 currently. Hi, I've checked with pulp-server-2.6.0-0.5.beta.git.93.014a6ca.fc21.noarch and this seems fixed now --- is it expected in the beta build? If that's the case, I'll mark verified... pulled wrong pulp repo; status is OK; leaving on MODIFIED Moved to https://pulp.plan.io/issues/412 |
Description of problem: Association of importer with invalid importer type should return 404, and not a call report that later will fail. $ curl -H "Accept: application/json" -X POST -k -u admin:admin -d '{"importer_type_id": "yum_importer1", "importer_config":{}}' 'https://example.com/pulp/api/v2/repositories/m1/importers/' | python -m json.tool % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 231 100 172 100 59 126 43 0:00:01 0:00:01 --:--:-- 126 { "error": null, "result": null, "spawned_tasks": [ { "_href": "/pulp/api/v2/tasks/0f3e8cbd-ea84-445a-9a1d-b29f6d11e922/", "task_id": "0f3e8cbd-ea84-445a-9a1d-b29f6d11e922" } ] } $ curl -H "Accept: application/json" -X GET -k -u admin:admin 'https://example.com/pulp/api/v2/tasks/0f3e8cbd-ea84-445a-9a1d-b29f6d11e922/' | python -m json.tool % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1277 100 1277 0 0 1530 0 --:--:-- --:--:-- --:--:-- 1529 { "_href": "/pulp/api/v2/tasks/0f3e8cbd-ea84-445a-9a1d-b29f6d11e922/", "_id": { "$oid": "533d6e1e3965e4939dfae505" }, "_ns": "task_status", "error": { "code": "PLP0015", "data": { "properties": "['importer_type_id']", "property_names": [ "importer_type_id" ] }, "description": "Invalid properties: ['importer_type_id']", "sub_errors": [] }, "finish_time": 1396534814, "queue": "reserved_resource_worker-0.compute.internal", "start_time": 1396534814, "state": "error", "tags": [ "pulp:repository:m1", "pulp:action:add_importer" ], "task_id": "0f3e8cbd-ea84-445a-9a1d-b29f6d11e922", "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 117, in set_importer\n raise InvalidValue(['importer_type_id'])\nInvalidValue: Invalid properties: ['importer_type_id']\n" } 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. create repo 2. associate importer with invalid importer type 3. Actual results: Association of importer with invalid importer type returns 202(a task that fails) Expected results: Association of importer with invalid importer type returns 404 Additional info: