On Wednesday, March 27, 2013 12:01:32 PM Richard Marko wrote:
Signed-off-by: Richard Marko <rmarko(a)redhat.com>
---
pyfaf/bugzilla.py | 4 ++++
pyfaf/kb.py | 18 ++++++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/pyfaf/bugzilla.py b/pyfaf/bugzilla.py
index e7b4503..16945e1 100644
--- a/pyfaf/bugzilla.py
+++ b/pyfaf/bugzilla.py
@@ -718,6 +718,10 @@ class Bugzilla(object):
logging.warning('Refusing to process report with no
backtrace.') continue
+ if pyfaf.kb.report_in_kb(self.db, report):
+ logging.info('Report matches knowledge base entry,
skipping.') + continue
+
if report.packages:
data['package'] = report.packages[0].installed_package
if report.reasons:
diff --git a/pyfaf/kb.py b/pyfaf/kb.py
index 840f02e..18a5909 100644
--- a/pyfaf/kb.py
+++ b/pyfaf/kb.py
@@ -37,3 +37,21 @@ def get_kb_pkgname_parsers(db, opsys_id=None):
result[parser] = kbentry.solution
return result
+
+
+def report_in_kb(db, report):
+ '''
+ Check if `report` matches entry in knowledge base.
+ '''
+ if not report.backtraces:
+ return False
I missed the code above because I expected that there is empty line between
comment and code.
+
+ bt = report.backtraces[0]
+ parsers = get_kb_btpath_parsers(db)
+
+ for parser in parsers:
+ for frame in bt.frames:
+ if parser.match(frame.symbolsource.path):
+ return True
+
+ return False