Bug 1078340 - In importer association to a repo "importer_config" should be a required key
Summary: In importer association to a repo "importer_config" should be a required key
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Pulp
Classification: Retired
Component: API/integration
Version: unspecified
Hardware: Unspecified
OS: Unspecified
medium
unspecified
Target Milestone: ---
: ---
Assignee: pulp-bugs
QA Contact: pulp-qe-list
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-03-19 15:54 UTC by Ina Panova
Modified: 2015-02-28 22:03 UTC (History)
1 user (show)

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


Attachments (Terms of Use)


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

Description Ina Panova 2014-03-19 15:54:43 UTC
Description of problem:
https://pulp-dev-guide.readthedocs.org/en/latest/integration/rest-api/repo/cud.html#associate-an-importer-to-a-repository

When associating an importer to a repository 'importer_config' field behaves as an optional field instead of required field.
So if 'importer_config' is not specified no error like "Configuration key [importer_config] is required, but was not provided" is raised.

$ curl -H "Accept: application/json" -X POST -k -u admin:admin -d '{"importer_type_id":"yum_importer"}' 'https://ec2-54-217-78-7.eu-west-1.compute.amazonaws.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   207  100   172  100    35    124     25  0:00:01  0:00:01 --:--:--   124
{
    "error": null,
    "result": null,
    "spawned_tasks": [
        {
            "_href": "/pulp/api/v2/tasks/f29266ee-735a-4f85-8901-bd0d7ded7581/",
            "task_id": "f29266ee-735a-4f85-8901-bd0d7ded7581"
        }
    ]
}

This behaviour leads to further issues when update of the importer is done:

$ 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/m1/importers/yum_importer/'
HTTP/1.1 202 Accepted
Date: Wed, 19 Mar 2014 15:44:02 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/dc77306b-7518-45ea-9983-60913457977e/", "task_id": "dc77306b-7518-45ea-9983-60913457977e"}], "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/dc77306b-7518-45ea-9983-60913457977e/'| python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1243  100  1243    0     0   1167      0  0:00:01  0:00:01 --:--:--  1168
{
    "_href": "/pulp/api/v2/tasks/dc77306b-7518-45ea-9983-60913457977e/",
    "_id": {
        "$oid": "5329bb446380d1e4b56c749c"
    },
    "_ns": "task_status",
    "error": {
        "code": "PLP0000",
        "data": {},
        "description": "'NoneType' object is not iterable",
        "sub_errors": []
    },
    "finish_time": 1395243844,
    "queue": "reserved_resource_worker-0.compute.internal",
    "start_time": 1395243844,
    "state": "error",
    "tags": [
        "pulp:repository:m1",
        "pulp:repository_importer:yum_importer",
        "pulp:action:update_importer"
    ],
    "task_id": "dc77306b-7518-45ea-9983-60913457977e",
    "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 249, in update_importer_config\n    merged_config = dict(repo_importer['config'])\nTypeError: 'NoneType' object is not iterable\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 without 'importer_config"
3.

Actual results:
'importer_config' behaves as an optional key

Expected results:
'importer_config' should be a required key

Additional info:

Comment 1 Ina Panova 2014-03-19 15:57:41 UTC
Also see https://bugzilla.redhat.com/show_bug.cgi?id=1078296

Comment 2 Brian Bouterse 2015-02-28 22:03:31 UTC
Moved to https://pulp.plan.io/issues/405


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