Add bug number subject parsing

This commit adds bug number subject parsing the bug msg processing
so we properly handle setting the bug number in the mqtt topic.
This commit is contained in:
Matthew Treinish 2016-08-29 19:55:39 -04:00
parent b278fa0008
commit 314c1cb2d8
No known key found for this signature in database
GPG Key ID: FD12A0F214C9E177
1 changed files with 5 additions and 0 deletions

View File

@ -13,6 +13,8 @@
# under the License.
import email
import re
import imaplib2 as imaplib
@ -41,6 +43,9 @@ class LPImapWatcher(object):
event['bug-reporter'] = message['X-Launchpad-Bug-Reporter']
event['bug-modifier'] = message['X-Launchpad-Bug-Modifier']
event['tags'] = message['X-Launchpad-Bug-Tags'].split(' ')
subject = message['Subject']
bug_num_str = re.match('^\[(.*?)\]', subject).group(0)
event['bug-number'] = bug_num_str.split(' ')[1].rstrip(']')
bug_info = message['X-Launchpad-Bug'].split(';')
for info in bug_info:
clean_info = info.lstrip()