diff options
Diffstat (limited to 'monitor/josef_monitor.py')
| -rwxr-xr-x | monitor/josef_monitor.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/monitor/josef_monitor.py b/monitor/josef_monitor.py index a32cf7d..d9b65a1 100755 --- a/monitor/josef_monitor.py +++ b/monitor/josef_monitor.py @@ -49,6 +49,15 @@ class ctlog: self.root_hash = None self.build = build + if CONFIG.DB_PATH: + self.dbdir = CONFIG.DB_PATH + # self.dbdir = CONFIG.DB_PATH + name + "/" + if not os.path.exists(self.dbdir): + os.makedirs(self.dbdir) + + else: + self.dbdir = None + self.log("Starting monitor") @@ -71,8 +80,9 @@ class ctlog: if self.entries != start_size: if verify_subtree(self.sth, self.subtree, self.url): - self.log("Successfully build tree with " + str(self.entries - start_size) + \ - " new entries. Size: " + str(self.entries)) + pass + # self.log("Successfully build tree with " + str(self.entries - start_size) + \ + # " new entries. Size: " + str(self.entries)) else: self.log("ERROR Failed to build tree from entries.") @@ -88,8 +98,8 @@ class ctlog: tmp_data["leaf_hash"] = base64.b64encode(entry_hash) tmp_cert_data.append(tmp_data) new_leafs.append(entry_hash) - if CONFIG.DB_PATH: - db_add_certs(CONFIG.DB_PATH, tmp_cert_data) + if self.dbdir: + db_add_certs(self.dbdir, tmp_cert_data) if CONFIG.DEFAULT_CERT_FILE: append_file(CONFIG.DEFAULT_CERT_FILE, tmp_cert_data) subtree = reduce_tree(new_leafs, subtree) |
