Project

Profile

Help

Issue #405

closed

In importer association to a repo "importer_config" should be a required key

Added by ipanova@redhat.com about 9 years ago. Updated almost 4 years ago.

Status:
CLOSED - WONTFIX
Priority:
Normal
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
1. Low
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Pulp 2
Sprint:
Quarter:

Description

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": "",
"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:

+ This bug was cloned from Bugzilla Bug #1078340 +

Also available in: Atom PDF