Issue #412
closedAssociation of importer with invalid importer type should return 400
Description
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:--:-- 126
% 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 -
{
"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:--:-- --:--:-- --:--:-- 1529
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1277 100 1277 0 0 1530 0 -
{
"_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@ip-10-104-226-68.eu-west-1.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:
+ This bug was cloned from Bugzilla Bug #1084064 +