diff options
| author | Josef Gustafsson <josef.gson@gmail.com> | 2015-09-14 12:13:38 +0200 |
|---|---|---|
| committer | Josef Gustafsson <josef.gson@gmail.com> | 2015-09-14 12:13:38 +0200 |
| commit | d1fdfc9e9c567eec255e3e82fda3c082634bc0fa (patch) | |
| tree | 77a7a1945263d61497dce8d7ce5e8b4b9a4020c9 /monitor/josef_leveldb.py | |
| parent | 4b81149ede45a5638a5dbadac4c62540b1143bd5 (diff) | |
refactoring and moving things around
Diffstat (limited to 'monitor/josef_leveldb.py')
| -rwxr-xr-x | monitor/josef_leveldb.py | 10 |
1 files changed, 10 insertions, 0 deletions
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): |
