Actions
Issue #1483
closedpulp task details call failing for "add_importer"
Start date:
Due date:
Estimated time:
Severity:
3. High
Version:
Master
Platform Release:
2.8.0
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Pulp 2
Sprint:
Quarter:
Description
I have a task with the following details
Operations: add_importer
Resources: integration_test_id (repository)
State: Successful
Start Time: 2016-01-06T19:46:38Z
Finish Time: 2016-01-06T19:46:38Z
Task Id: f3ef176a-afac-4652-bcdc-d17eee7cc7f5
This was generated by
RestClient.post "https://<pulp-fqdn>/pulp/api/v2/repositories/integration_test_id/importers/", "{\"id\":\"integration_test_id\",\"importer_type_id\":\"yum_importer\",\"importer_config\":{}}", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"83", "accept"=>"application/json", "content_type"=>"application/json"
\n# => 202 Accepted | application/json 172 bytes
Viewing the task details of this either via pulp-admin OR runcible api causes the same error.
$ pulp-admin -vv tasks details --task-id=f3ef176a-afac-4652-bcdc-d17eee7cc7f5
+----------------------------------------------------------------------+
Task Details
+----------------------------------------------------------------------+
2016-01-06 16:57:54,559 - DEBUG - sending GET request to /pulp/api/v2/tasks/f3ef176a-afac-4652-bcdc-d17eee7cc7f5/
2016-01-06 16:57:54,597 - INFO - GET request to /pulp/api/v2/tasks/f3ef176a-afac-4652-bcdc-d17eee7cc7f5/ with parameters None
2016-01-06 16:57:54,598 - INFO - Response status : 500
2016-01-06 16:57:54,598 - INFO - Response body :
{
"exception": [
"TypeError: <Importer: Importer object> is not JSON serializable\n"
],
"traceback": [
" File \"/usr/lib/python2.7/site-packages/django/core/handlers/base.py\", line 112, in get_response\n response = wrapped_callback(request, *callback_args, **callback_kwargs)\n",
" File \"/usr/lib/python2.7/site-packages/django/views/generic/base.py\", line 69, in view\n return self.dispatch(request, *args, **kwargs)\n",
" File \"/usr/lib/python2.7/site-packages/django/views/generic/base.py\", line 87, in dispatch\n return handler(request, *args, **kwargs)\n",
" File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/views/decorators.py\", line 241, in _auth_decorator\n return _verify_auth(self, operation, super_user_only, method, *args, **kwargs)\n",
" File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/views/decorators.py\", line 195, in _verify_auth\n value = method(self, *args, **kwargs)\n",
" File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/views/tasks.py\", line 132, in get\n return generate_json_response_with_pulp_encoder(task_dict)\n",
" File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/views/util.py\", line 52, in generate_json_response\n json_obj = json.dumps(content, default=default)\n",
" File \"/usr/lib64/python2.7/json/__init__.py\", line 250, in dumps\n sort_keys=sort_keys, **kw).encode(obj)\n",
" File \"/usr/lib64/python2.7/json/encoder.py\", line 207, in encode\n chunks = self.iterencode(o, _one_shot=True)\n",
" File \"/usr/lib64/python2.7/json/encoder.py\", line 270, in iterencode\n return _iterencode(o, 0)\n",
" File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/views/util.py\", line 30, in pulp_json_encoder\n return json_util.default(obj)\n",
" File \"/usr/lib64/python2.7/site-packages/bson/json_util.py\", line 256, in default\n raise TypeError(\"%r is not JSON serializable\" % obj)\n"
],
"_href": "/pulp/api/v2/tasks/f3ef176a-afac-4652-bcdc-d17eee7cc7f5/",
"error_message": "<Importer: Importer object> is not JSON serializable",
"http_request_method": "GET",
"http_status": 500
}
2016-01-06 16:57:54,598 - ERROR - Exception occurred:
href: /pulp/api/v2/tasks/f3ef176a-afac-4652-bcdc-d17eee7cc7f5/
method: GET
status: 500
error: <Importer: Importer object> is not JSON serializable
traceback: [u' File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 112, in get_response\n response = wrapped_callback(request, *callback_args, **callback_kwargs)\n', u' File "/usr/lib/python2.7/site-packages/django/views/generic/base.py", line 69, in view\n return self.dispatch(request, *args, **kwargs)\n', u' File "/usr/lib/python2.7/site-packages/django/views/generic/base.py", line 87, in dispatch\n return handler(request, *args, **kwargs)\n', u' File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/decorators.py", line 241, in _auth_decorator\n return _verify_auth(self, operation, super_user_only, method, *args, **kwargs)\n', u' File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/decorators.py", line 195, in _verify_auth\n value = method(self, *args, **kwargs)\n', u' File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/tasks.py", line 132, in get\n return generate_json_response_with_pulp_encoder(task_dict)\n', u' File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/util.py", line 52, in generate_json_response\n json_obj = json.dumps(content, default=default)\n', u' File "/usr/lib64/python2.7/json/__init__.py", line 250, in dumps\n sort_keys=sort_keys, **kw).encode(obj)\n', u' File "/usr/lib64/python2.7/json/encoder.py", line 207, in encode\n chunks = self.iterencode(o, _one_shot=True)\n', u' File "/usr/lib64/python2.7/json/encoder.py", line 270, in iterencode\n return _iterencode(o, 0)\n', u' File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/util.py", line 30, in pulp_json_encoder\n return json_util.default(obj)\n', u' File "/usr/lib64/python2.7/site-packages/bson/json_util.py", line 256, in default\n raise TypeError("%r is not JSON serializable" % obj)\n']
data: {}
An internal error occurred on the Pulp server:
RequestException: GET request on
/pulp/api/v2/tasks/f3ef176a-afac-4652-bcdc-d17eee7cc7f5/ failed with 500 -
<Importer: Importer object> is not JSON serializable
/var/log/messages:
pulp.server.webservices.middleware.exception:ERROR: Unhandled Exception
pulp.server.webservices.middleware.exception:ERROR: (2355-01376) <Importer: Importer object> is not JSON serializable
pulp.server.webservices.middleware.exception:ERROR: (2355-01376) Traceback (most recent call last):
pulp.server.webservices.middleware.exception:ERROR: (2355-01376) File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 112,
pulp.server.webservices.middleware.exception:ERROR: (2355-01376) response = wrapped_callback(request, *callback_args, **callback_kwargs)
pulp.server.webservices.middleware.exception:ERROR: (2355-01376) File "/usr/lib/python2.7/site-packages/django/views/generic/base.py", line 69, i
pulp.server.webservices.middleware.exception:ERROR: (2355-01376) return self.dispatch(request, *args, **kwargs)
pulp.server.webservices.middleware.exception:ERROR: (2355-01376) File "/usr/lib/python2.7/site-packages/django/views/generic/base.py", line 87, i
pulp.server.webservices.middleware.exception:ERROR: (2355-01376) return handler(request, *args, **kwargs)
pulp.server.webservices.middleware.exception:ERROR: (2355-01376) File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/decorators.
pulp.server.webservices.middleware.exception:ERROR: (2355-01376) return _verify_auth(self, operation, super_user_only, method, *args, **kwargs)
pulp.server.webservices.middleware.exception:ERROR: (2355-01376) File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/decorators.
pulp.server.webservices.middleware.exception:ERROR: (2355-01376) value = method(self, *args, **kwargs)
pulp.server.webservices.middleware.exception:ERROR: (2355-01376) File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/tasks.py",
pulp.server.webservices.middleware.exception:ERROR: (2355-01376) return generate_json_response_with_pulp_encoder(task_dict)
pulp.server.webservices.middleware.exception:ERROR: (2355-01376) File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/util.py", l
pulp.server.webservices.middleware.exception:ERROR: (2355-01376) json_obj = json.dumps(content, default=default)
pulp.server.webservices.middleware.exception:ERROR: (2355-01376) File "/usr/lib64/python2.7/json/__init__.py", line 250, in dumps
pulp.server.webservices.middleware.exception:ERROR: (2355-01376) sort_keys=sort_keys, **kw).encode(obj)
pulp.server.webservices.middleware.exception:ERROR: (2355-01376) File "/usr/lib64/python2.7/json/encoder.py", line 207, in encode
pulp.server.webservices.middleware.exception:ERROR: (2355-01376) chunks = self.iterencode(o, _one_shot=True)
pulp.server.webservices.middleware.exception:ERROR: (2355-01376) File "/usr/lib64/python2.7/json/encoder.py", line 270, in iterencode
pulp.server.webservices.middleware.exception:ERROR: (2355-01376) return _iterencode(o, 0)
pulp.server.webservices.middleware.exception:ERROR: (2355-01376) File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/util.py", l
pulp.server.webservices.middleware.exception:ERROR: (2355-01376) return json_util.default(obj)
pulp.server.webservices.middleware.exception:ERROR: (2355-01376) File "/usr/lib64/python2.7/site-packages/bson/json_util.py", line 256, in defaul
pulp.server.webservices.middleware.exception:ERROR: (2355-01376) raise TypeError("%%r is not JSON serializable" %% obj)
pulp.server.webservices.middleware.exception:ERROR: (2355-01376) TypeError: <Importer: Importer object> is not JSON serializable
Actions
Ensures setting an importer serializes into the task result
The importer conversion introduced a regression where when you update an importer it saved a reference to the new importer itself in the TaskStatus instead of a serializer verison of it.
When that TaskStatus was fetched, it could not be serialized by the webservices layer and caused a 500 exception.
https://pulp.plan.io/issues/1483 closes #1483