From d1fdfc9e9c567eec255e3e82fda3c082634bc0fa Mon Sep 17 00:00:00 2001 From: Josef Gustafsson Date: Mon, 14 Sep 2015 12:13:38 +0200 Subject: refactoring and moving things around --- monitor/josef_leveldb.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'monitor/josef_leveldb.py') diff --git a/monitor/josef_leveldb.py b/monitor/josef_leveldb.py index 769f6f3..fa948ed 100755 --- a/monitor/josef_leveldb.py +++ b/monitor/josef_leveldb.py @@ -12,6 +12,9 @@ SEP = ";" dbs = {} + + + def match_domain(d1, d2): # Exact match if d1 == d2: @@ -34,6 +37,7 @@ def match_domain(d1, d2): def db_open(fn='./cert_db'): + print "Opening " + fn global dbs if fn in dbs: return dbs[fn] @@ -43,6 +47,11 @@ def db_open(fn='./cert_db'): dbs[fn] = db return db +def db_close(): + print "Closing databases." + for db in dbs: + del db + def db_append(db, key, val): if db is None: print "ERROR: NO DATABASE SET!" @@ -112,6 +121,7 @@ def db_add_certs(db_dir, data): pass except IndexError: pass + db_close() def db_lookup_domain(db_dir, domain): -- cgit v1.1