Bug 1084064 - Association of importer with invalid importer type should return 400
Summary: Association of importer with invalid importer type should return 400
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Pulp
Classification: Retired
Component: API/integration
Version: unspecified
Hardware: Unspecified
OS: Unspecified
medium
unspecified
Target Milestone: ---
: 2.6.1
Assignee: Jeremy Cline
QA Contact: pulp-qe-list
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-04-03 14:25 UTC by Ina Panova
Modified: 2015-02-28 22:04 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-02-28 22:04:34 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Pulp Redmine 412 0 None None None Never

Description Ina Panova 2014-04-03 14:25:13 UTC
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:

Comment 1 Ina Panova 2014-04-03 14:25:45 UTC
see also https://bugzilla.redhat.com/show_bug.cgi?id=1078833

Comment 2 Ina Panova 2014-04-03 14:31:23 UTC
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"

Comment 3 Jeremy Cline 2014-12-11 21:17:14 UTC
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.

Comment 4 Jeremy Cline 2015-01-13 15:01:43 UTC
This was merged into 2.6-dev, which I *believe* maps to 2.6.1 currently.

Comment 5 mkovacik 2015-02-03 20:59:03 UTC
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...

Comment 6 mkovacik 2015-02-05 18:07:08 UTC
pulled wrong pulp repo; status is OK; leaving on MODIFIED

Comment 7 Brian Bouterse 2015-02-28 22:04:34 UTC
Moved to https://pulp.plan.io/issues/412


Note You need to log in before you can comment on or make changes to this bug.