From 5ab0d2319f548a3d147b802ecbbc7c982b5b24db Mon Sep 17 00:00:00 2001 From: urlbot Date: Tue, 9 Jun 2015 14:56:29 +0200 Subject: [PATCH] parse_debbug(): parse and fetch multiple bugs --- plugins.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/plugins.py b/plugins.py index 3fd9da4..0983f8c 100644 --- a/plugins.py +++ b/plugins.py @@ -69,19 +69,22 @@ def parse_debbug(**args): if not bugs: return None - url = 'https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=%s' % bugs[0] - status, title = extract_title(url) + out = [] + for b in bugs: + logger('plugin', 'detected Debian bug #%s' % b) - if 0 == status: - title = 'Debian Bug: %s: %s' % (title, url) - elif 3 == status: - pass - else: - return None + url = 'https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=%s' % b + status, title = extract_title(url) + + if 0 == status: + out.append('Debian Bug: %s: %s' % (title, url)) + elif 3 == status: + out.append('error for #%s: %s' % (b, title)) + else: + logger('plugin', 'parse_debbug(): unknown status %d' % status) - logger('plugin', 'detected Debian bug') return { - 'msg': title + 'msg': out } @pluginfunction('cve', 'parse a CVE handle', ptypes_PARSE, ratelimit_class = RATE_NO_SILENCE | RATE_GLOBAL)