Bug 765874

Summary: Non-Task AMQP events broken which breaks manager layer functions when event are enabled
Product: [Retired] Pulp Reporter: Jeff Ortel <jortel>
Component: z_otherAssignee: Jeff Ortel <jortel>
Status: CLOSED CURRENTRELEASE QA Contact: Preethi Thomas <pthomas>
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: dgregor, dmach
Target Milestone: ---Keywords: Triaged
Target Release: Sprint 30   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-02-24 20:14:01 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 563609    

Description Jeff Ortel 2011-12-09 15:39:33 UTC
Description of problem:

The task.dequeued event handler contains a TaskDequeued class that is added as a task callback associated with repo sync.  Because of this, the event handler module is loaded.  When this happens, the Task event handler is loaded.  Rather than using a flag to track loading status, the logic in the EventDispatcher.load() just looked to see if the handlers collection was empty.  Since the TaskEvent handler was already loaded by import into the repo sync manager, the EventHandler.load() was tricked into thinking ALL the handlers ere loaded.  The net result is that only the TaskEvent handler is loaded so when events are enabled, manager layer methods decorated to raise events - result in event handler related traceback.


How reproducible:

always

Steps to Reproduce:
1. Edit /etc/pulp/pulp.conf and set [event] send_enabled=true
2. bounce httpd
3. create a repo
  
Actual results:

2011-12-09 08:54:21,421 22031:-1321227408: pulp.server.webservices.controllers.decorators:ERROR: decorators:52 Traceback (most recent call last):
  File "/home/jortel/git/pulp/src/pulp/server/webservices/controllers/decorators.py", line 48, in report_error
    return method(self, *args, **kwargs)
  File "/home/jortel/git/pulp/src/pulp/server/webservices/controllers/decorators.py", line 127, in _auth_decorator
    value = method(self, *args, **kwargs)
  File "/home/jortel/git/pulp/src/pulp/server/webservices/controllers/repositories.py", line 253, in POST
    content_types=repo_data.get('content_types', 'yum'))
  File "/home/jortel/git/pulp/src/pulp/server/api/repo.py", line 322, in create
    self.__created(r)
  File "/home/jortel/git/pulp/src/pulp/server/event/dispatcher.py", line 82, in call
    EventDispatcher.handler(entity, outbound=action)
  File "/home/jortel/git/pulp/src/pulp/server/event/dispatcher.py", line 235, in handler
    'handler for entity "%s", not found' % entity
Exception: handler for entity "repo", not found

Expected results:

Happiness.

Additional info:

Comment 1 Jeff Ortel 2011-12-09 15:40:27 UTC
Changed logic in EventHandler.load() to use a flag instead.

Comment 2 Jeff Ortel 2011-12-12 14:14:45 UTC
build: 0.254-5

Comment 3 Preethi Thomas 2011-12-13 16:10:04 UTC
verified
[root@pulp-f16 ~]# rpm -q pulp
pulp-0.0.254-6.fc16.noarch
[root@pulp-f16 ~]# 

[root@pulp-f16 ~]# cat /etc/pulp/pulp.conf  |grep send_enabled
send_enabled: true 

[root@pulp-f16 ~]# pulp-admin -u admin -p admin repo create --id=pulp --feed=http://repos.fedorapeople.org/repos/pulp/pulp/testing/fedora-15/x86_64/ --relativepath=pulp
Successfully created repository [ pulp ]

Comment 4 Preethi Thomas 2012-02-24 20:14:01 UTC
Pulp v1.0 is released
Closed Current Release.