Commit c10d9361 authored by Ad Schellevis's avatar Ad Schellevis

(ids) check for existing rulecache before read

parent f08169cd
...@@ -165,6 +165,7 @@ class RuleCache(object): ...@@ -165,6 +165,7 @@ class RuleCache(object):
:return: dict :return: dict
""" """
result = {'rows':[]} result = {'rows':[]}
if os.path.exists(self.cachefile):
db = sqlite3.connect(self.cachefile) db = sqlite3.connect(self.cachefile)
cur = db.cursor() cur = db.cursor()
...@@ -233,6 +234,7 @@ class RuleCache(object): ...@@ -233,6 +234,7 @@ class RuleCache(object):
:return: list of installed classtypes :return: list of installed classtypes
""" """
result = [] result = []
if os.path.exists(self.cachefile):
db = sqlite3.connect(self.cachefile) db = sqlite3.connect(self.cachefile)
cur = db.cursor() cur = db.cursor()
cur.execute('select distinct classtype from rules') cur.execute('select distinct classtype from rules')
...@@ -240,3 +242,5 @@ class RuleCache(object): ...@@ -240,3 +242,5 @@ class RuleCache(object):
result.append(record[0]) result.append(record[0])
return sorted(result) return sorted(result)
else:
return result
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment