Issue #565
closedServer-side traceback when publishing with a non-existing distributor id
Description
Description of problem:
If an API user queues a publish[0] with a distributor-id that doesn't exist, a traceback is logged to syslog.
Version-Release number of selected component (if applicable):
2.4.0-1
How reproducible:
Every time.
Steps to Reproduce:
1. Create a repository:
(pulp)[rbarlow@pamphlet]~/devel/pulp% pulp-admin puppet repo create --repo-id forge --queries=postgres --feed http://forge.puppetlabs.com
2. Try to publish it with a non-existing distributor id:
(pulp)[rbarlow@pamphlet]~/devel/pulp% python
Python 2.6.6 (r266:84292, Jan 22 2014, 09:42:36)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
from pulp.common import pic
pic.connect()
pic.POST ('/pulp/api/v2/repositories/forge/actions/publish/', {'id': "does_not_exist"})
Request Body
{
"id": "542ee4bcea912d1fe934f5ef"
}
Response Body
{
"spawned_tasks": [
{
"_href": "/pulp/api/v2/tasks/cf5413f6-ac5b-4d98-b740-7d720e3475eb/",
"task_id": "cf5413f6-ac5b-4d98-b740-7d720e3475eb"
}
],
"result": null,
"error": null
}
(202, {u'spawned_tasks': [{u'_href': u'/pulp/api/v2/tasks/cf5413f6-ac5b-4d98-b740-7d720e3475eb/', u'task_id': u'cf5413f6-ac5b-4d98-b740-7d720e3475eb'}], u'result': None, u'error': None})
Actual results:
In syslog, you will find this:
Oct 3 14:18:06 pamphlet pulp: celery.worker.job:ERROR: Task pulp.server.managers.repo.publish.publish[cf5413f6-ac5b-4d98-b740-7d720e3475eb] raised unexpected: MissingResource({'resource_id': {'distributor': '542ee4bcea912d1fe934f5ef', 'repository': u'forge'}},)
Oct 3 14:18:06 pamphlet pulp: celery.worker.job:ERROR: Traceback (most recent call last):
Oct 3 14:18:06 pamphlet pulp: celery.worker.job:ERROR: File "/usr/lib/python2.6/site-packages/celery/app/trace.py", line 240, in trace_task
Oct 3 14:18:06 pamphlet pulp: celery.worker.job:ERROR: R = retval = fun(*args, **kwargs)
Oct 3 14:18:06 pamphlet pulp: celery.worker.job:ERROR: File "/usr/lib/python2.6/site-packages/pulp/server/async/tasks.py", line 315, in call
Oct 3 14:18:06 pamphlet pulp: celery.worker.job:ERROR: return super(Task, self).__call__(*args, **kwargs)
Oct 3 14:18:06 pamphlet pulp: celery.worker.job:ERROR: File "/usr/lib/python2.6/site-packages/celery/app/trace.py", line 437, in protected_call
Oct 3 14:18:06 pamphlet pulp: celery.worker.job:ERROR: return self.run(*args, **kwargs)
Oct 3 14:18:06 pamphlet pulp: celery.worker.job:ERROR: File "/usr/lib/python2.6/site-packages/pulp/server/managers/repo/publish.py", line 80, in publish
Oct 3 14:18:06 pamphlet pulp: celery.worker.job:ERROR: raise MissingResource(repository=repo_id, distributor=distributor_id)
Oct 3 14:18:06 pamphlet pulp: celery.worker.job:ERROR: MissingResource: Missing resource(s): distributor=542ee4bcea912d1fe934f5ef, repository=forge
Expected results:
It would be reasonable to note the missing resource at the debug level (without traceback), but I don't think we should log 404s at INFO at all.
Additional info:
[0] https://pulp-dev-guide.readthedocs.org/en/latest/integration/rest-api/repo/publish.html#publish-a-repository
+ This bug was cloned from Bugzilla Bug #1149339 +