Issue #404
closed"importer_config" can't be updated with 'update repo' call if "importer_config" wasn't specified within 'repo create' call
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:--:-- --:--:-- --:--:-- 273
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 427 100 216 100 211 273 267 -
{
"_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:--:-- --:--:-- --:--:-- 6052
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 4799 100 4648 100 151 6054 196 -
{
"_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:--:-- --:--:-- --:--:-- 239
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 225 100 225 0 0 240 0 -
[
{
"_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:--:-- --:--:-- --:--:-- 256
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 448 100 216 100 232 237 255 -
{
"_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:--:-- --:--:-- --:--:-- 257
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 372 100 221 100 151 257 175 -
{
"_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:--:-- --:--:-- --:--:-- 299
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 239 100 239 0 0 299 0 -
[
{
"_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 +
Updated by ipanova@redhat.com almost 9 years ago
Also see https://bugzilla.redhat.com/show_bug.cgi?id=1078340
+ This comment was cloned from Bugzilla #1078296 comment 1 +
Updated by bmbouter over 4 years ago
- Status changed from NEW to CLOSED - WONTFIX
Updated by bmbouter over 4 years ago
- Severity set to 1. Low
Pulp 2 is approaching maintenance mode, and this Pulp 2 ticket is not being actively worked on. As such, it is being closed as WONTFIX. Pulp 2 is still accepting contributions though, so if you want to contribute a fix for this ticket, please reopen or comment on it. If you don't have permissions to reopen this ticket, or you want to discuss an issue, please reach out via the developer mailing list.
Updated by bmbouter over 3 years ago
- Category deleted (
14)
We are removing the 'API' category per open floor discussion June 16, 2020.