Bug 1149339 - Server-side traceback when publishing with a non-existing distributor id
Summary: Server-side traceback when publishing with a non-existing distributor id
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Pulp
Classification: Retired
Component: API/integration
Version: 2.4.0
Hardware: All
OS: Linux
medium
low
Target Milestone: ---
: ---
Assignee: pulp-bugs
QA Contact: pulp-qe-list
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-10-03 18:34 UTC by Randy Barlow
Modified: 2015-02-28 22:38 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-02-28 22:38:16 UTC


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Pulp Redmine 565 0 None None None Never

Description Randy Barlow 2014-10-03 18:34:38 UTC
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

Comment 1 Michael Hrivnak 2014-10-08 16:29:04 UTC
This may be fixed in 2.5 according to jcline.

Comment 2 Jeremy Cline 2014-10-08 17:57:17 UTC
Sadly this is not fixed in 2.5. I believe my fix doesn't cover async tasks, so this is probably an issue for all async tasks that raise exceptions.

Comment 3 Brian Bouterse 2015-02-28 22:38:16 UTC
Moved to https://pulp.plan.io/issues/565


Note You need to log in before you can comment on or make changes to this bug.