Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Modify bugzilla bot plugin to handle multiple search queries
Browse files Browse the repository at this point in the history
  • Loading branch information
pwnbus committed Feb 9, 2018
1 parent 2c84163 commit fa2252c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
20 changes: 11 additions & 9 deletions bot/modules/zilla.py
Expand Up @@ -62,15 +62,17 @@ def bugzilla_search(self):
except AttributeError:
_log.warning("zilla could not load search terms")
return
try:
res = self._bugzilla.search_bugs(terms)
except Exception as e:
_log.error('Error querying bugzilla' + str(e))
return
for bug in res['bugs']:
bugsummary = bug['summary'].encode('utf-8', 'replace')
self.controller.client.msg(self.channel, "\x037\x02WARNING\x03\x02 \x032\x02NEW\x03\x02 bug: {url}{bugid} {summary}".format(summary=bugsummary,
url=self.url, bugid=bug['id']))

for search_group in terms:
try:
res = self._bugzilla.search_bugs(search_group)
except Exception as e:
_log.error('Error querying bugzilla' + str(e))
return
for bug in res['bugs']:
bugsummary = bug['summary'].encode('utf-8', 'replace')
self.controller.client.msg(self.channel, "\x037\x02WARNING\x03\x02 \x032\x02NEW\x03\x02 bug: {url}{bugid} {summary}".format(summary=bugsummary,
url=self.url, bugid=bug['id']))

def start(self, *args, **kwargs):
super(Zilla, self).start(*args, **kwargs)
Expand Down
3 changes: 1 addition & 2 deletions bot/mozdefbot.conf
Expand Up @@ -19,5 +19,4 @@ url = https://bugzilla.mozilla.org/
api_key = <add_api_key>
interval= 300
channel = #somechannel
search_terms = [{"product": "<add_product_name>"}, {"status": "NEW"}, {"status": "UNCONFIRMED"}]

search_terms = [[{"product": "<add_product_name>"}, {"status": "NEW"}, {"status": "UNCONFIRMED"}]]

0 comments on commit fa2252c

Please sign in to comment.