Fixed wrong field name in requests/mailer code
authorEd Bartosh <eduard.bartosh@intel.com>
Fri, 4 Oct 2013 09:43:07 +0000 (12:43 +0300)
committerGerrit Code Review <gerrit2@otctools.jf.intel.com>
Wed, 9 Oct 2013 06:24:08 +0000 (23:24 -0700)
Event, which comes from OBS doesn't have 'type' field. 'event_type'
should be used.

Looks like this code has never been tested and as a result caused
serious production issue: all email notifications have been lost.

Fixes: #1360

Change-Id: Ie73949d4d270219ee2261597b2418ec1a3a8b806
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
requests/mailer.py

index 9140ef4..f53d8e8 100644 (file)
@@ -225,12 +225,12 @@ def mailer(request, _bs, request_data, sr_enabled_users=None, \
 
     return_dict = {}
 
-    if request['type'] not in MAIL_TRIGGERS:
+    if request['event_type'] not in MAIL_TRIGGERS:
         return {}
     rid = request['id']
 
     for event, triggers in MAIL_TRIGGERS.iteritems():
-        if request['type'] != event:
+        if request['event_type'] != event:
             continue
 
         for tri in triggers: