Project

Profile

Help

Issue #404

closed

"importer_config" can't be updated with 'update repo' call if "importer_config" wasn't specified within 'repo create' call

Added by ipanova@redhat.com almost 8 years ago. Updated over 2 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:
Docs say that in repo creation call "importer_config" field is optional. However if during repo creation call "importer_config" field was not specified, then in update repo call of "importer_config" will fail with a traceback.

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 omitting optional field "importer_config"
2. update repo

Actual results:
it is impossible to update importer_config

Expected results:
importer_config is updated as expected

Additional info:
1) create repo
$ curl H "Accept: application/json" -X POST -k -u admin:admin -d '{"distributors": [{"distributor_id": "yum_distributor","distributor_type": "yum_distributor","distributor_config":{"http":true,"https":false,"relative_url":"m5"}}],"importer_type_id": "yum_importer", "id": "m5"}' 'https://example.com/pulp/api/v2/repositories/'|python -m json.tool
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 427 100 216 100 211 273 267 -
:--:-- --:--:-- --:--:-- 273
{
"_href": "/pulp/api/v2/repositories/m5/",
"_id": {
"$oid": "5329a47233d13e72f5c099da"
},
"_ns": "repos",
"content_unit_counts": {},
"description": null,
"display_name": "m5",
"id": "m5",
"notes": {},
"scratchpad": {}
}

2)Update repo
$ curl H "Accept: application/json" -X PUT -k -u admin:admin -d '{"delta": {"display_name" : "Updated"},"importer_config": {"num_units": "6"},"distributor_configs":{"yum_distributor":{"relative_url": "another_url"}}}' 'https://example.com/pulp/api/v2/repositories/m5/'| python -m json.tool
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 4799 100 4648 100 151 6054 196 -
:--:-- --:--:-- --:--:-- 6052
{
"_href": "/pulp/api/v2/repositories/m5/",
"error_message": "Unhandled Exception",
"exception": [
"TypeError: 'NoneType' object is not iterable\n"
],
"http_request_method": "PUT",
"http_status": 500,
"traceback": [
" File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/middleware/exception.py\", line 44, in call\n return self.app(environ, start_response)\n",
" File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/middleware/postponed.py\", line 42, in call\n return self.app(environ, start_response)\n",
" File \"/usr/lib/python2.7/site-packages/web/application.py\", line 279, in wsgi\n result = self.handle_with_processors()\n",
" File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py\", line 26, in _handle_with_processors\n return process(self.processors)\n",
" File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py\", line 23, in process\n return p(lambda : process(processors))\n",
" File \"/usr/lib/python2.7/site-packages/web/application.py\", line 566, in processor\n return handler()\n",
" File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py\", line 23, in <lambda>\n return p(lambda : process(processors))\n",
" File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py\", line 23, in process\n return p(lambda : process(processors))\n",
" File \"/usr/lib/python2.7/site-packages/web/application.py\", line 581, in processor\n result = handler()\n",
" File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py\", line 23, in <lambda>\n return p(lambda : process(processors))\n",
" File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py\", line 25, in process\n return self.handle()\n",
" File \"/usr/lib/python2.7/site-packages/web/application.py\", line 230, in handle\n return self._delegate(fn, self.fvars, args)\n",
" File \"/usr/lib/python2.7/site-packages/web/application.py\", line 422, in _delegate\n return f()\n",
" File \"/usr/lib/python2.7/site-packages/web/application.py\", line 430, in <lambda>\n f = lambda: self._delegate_sub_application(pat, what)\n",
" File \"/usr/lib/python2.7/site-packages/web/application.py\", line 455, in _delegate_sub_application\n return app.handle_with_processors()\n",
" File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py\", line 26, in _handle_with_processors\n return process(self.processors)\n",
" File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py\", line 23, in process\n return p(lambda : process(processors))\n",
" File \"/usr/lib/python2.7/site-packages/web/application.py\", line 566, in processor\n return handler()\n",
" File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py\", line 23, in <lambda>\n return p(lambda : process(processors))\n",
" File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py\", line 23, in process\n return p(lambda : process(processors))\n",
" File \"/usr/lib/python2.7/site-packages/web/application.py\", line 581, in processor\n result = handler()\n",
" File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py\", line 23, in <lambda>\n return p(lambda : process(processors))\n",
" File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py\", line 25, in process\n return self.handle()\n",
" File \"/usr/lib/python2.7/site-packages/web/application.py\", line 230, in handle\n return self._delegate(fn, self.fvars, args)\n",
" File \"/usr/lib/python2.7/site-packages/web/application.py\", line 420, in _delegate\n return handle_class(cls)\n",
" File \"/usr/lib/python2.7/site-packages/web/application.py\", line 396, in handle_class\n return tocall(*args)\n",
" File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/controllers/decorators.py\", line 228, in _auth_decorator\n value = method(self, *args, **kwargs)\n",
" File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/controllers/repositories.py\", line 275, in PUT\n task_result = repo_manager.update_repo_and_plugins(repo_id, delta, importer_config, distributor_configs)\n",
" File \"/usr/lib/python2.7/site-packages/pulp/server/managers/repo/cud.py\", line 425, in update_repo_and_plugins\n importer_manager.update_importer_config(repo_id, importer_config)\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'])\n"
]
}

Note that config of the importer is 'null'
$ curl H "Accept: application/json" -X GET -k -u admin:admin 'https://example.com/pulp/api/v2/repositories/m5/importers/'| python -m json.tool
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 225 100 225 0 0 240 0 -
:--:-- --:--:-- --:--:-- 239
[
{
"_id": {
"$oid": "5329a47233d13e72f5c099db"
},
"_ns": "repo_importers",
"config": null,
"id": "yum_importer",
"importer_type_id": "yum_importer",
"last_sync": null,
"repo_id": "m5",
"scheduled_syncs": [],
"scratchpad": null
}
]

Meanwhile if during repo creation call "importer_config" is provided(even empty dict), then repo update is performed with no issues:

]$ curl H "Accept: application/json" -X POST -k -u admin:admin -d '{"distributors": [{"distributor_id": "yum_distributor","distributor_type": "yum_distributor","distributor_config":{"http":true,"https":false,"relative_url":"m5"}}],"importer_type_id": "yum_importer", "id": "m5","importer_config":{}}' 'https://example.com/pulp/api/v2/repositories/'|python -m json.tool
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 448 100 216 100 232 237 255 -
:--:-- --:--:-- --:--:-- 256
{
"_href": "/pulp/api/v2/repositories/m5/",
"_id": {
"$oid": "5329a76133d13e72f5c099e7"
},
"_ns": "repos",
"content_unit_counts": {},
"description": null,
"display_name": "m5",
"id": "m5",
"notes": {},
"scratchpad": {}
}

$ curl H "Accept: application/json" -X PUT -k -u admin:admin -d '{"delta": {"display_name" : "Updated"},"importer_config": {"num_units": "6"},"distributor_configs":{"yum_distributor":{"relative_url": "another_url"}}}' 'https://example.com/pulp/api/v2/repositories/m5/'| python -m json.tool
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 372 100 221 100 151 257 175 -
:--:-- --:--:-- --:--:-- 257
{
"_href": "/pulp/api/v2/repositories/m5/",
"_id": {
"$oid": "5329a76133d13e72f5c099e7"
},
"_ns": "repos",
"content_unit_counts": {},
"description": null,
"display_name": "Updated",
"id": "m5",
"notes": {},
"scratchpad": {}
}

$ curl H "Accept: application/json" -X GET -k -u admin:admin 'https://example.com/pulp/api/v2/repositories/m5/importers/'| python -m json.tool
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 239 100 239 0 0 299 0 -
:--:-- --:--:-- --:--:-- 299
[
{
"_id": {
"$oid": "5329a76133d13e72f5c099e8"
},
"_ns": "repo_importers",
"config": {
"num_units": "6"
},
"id": "yum_importer",
"importer_type_id": "yum_importer",
"last_sync": null,
"repo_id": "m5",
"scheduled_syncs": [],
"scratchpad": null
}
]

+ This bug was cloned from Bugzilla Bug #1078296 +

Also available in: Atom PDF