Bug 1078340

Summary: In importer association to a repo "importer_config" should be a required key
Product: [Retired] Pulp Reporter: Ina Panova <ipanova>
Component: API/integrationAssignee: pulp-bugs
Status: CLOSED UPSTREAM QA Contact: pulp-qe-list
Severity: unspecified Docs Contact:
Priority: medium    
Version: unspecifiedCC: skarmark
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-28 22:03:31 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:

Description Ina Panova 2014-03-19 15:54:43 UTC
Description of problem:

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": [
    "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):

How reproducible:

Steps to Reproduce:
1. create repo
2. associate importer without 'importer_config"

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