From 9dd7093009e1e8b496741b7358a33f6eb91ebc88 Mon Sep 17 00:00:00 2001 From: Josef Gustafsson Date: Thu, 24 Sep 2015 10:08:38 +0200 Subject: monitor error handling for unavailable services --- monitor/josef_monitor.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'monitor/josef_monitor.py') diff --git a/monitor/josef_monitor.py b/monitor/josef_monitor.py index bce3080..c52f29c 100755 --- a/monitor/josef_monitor.py +++ b/monitor/josef_monitor.py @@ -51,7 +51,11 @@ class ctlog: def incremental_build(self): # Keeps state current during build, partial builds are possible. - self.sth = get_sth(self.url) + try: + self.sth = get_sth(self.url) + except Exception, e: + self.log("Failed to fetch STH. " + str(e)) + return start_size = self.entries while self.entries < self.sth["tree_size"]: tmp_size = self.entries @@ -120,7 +124,11 @@ class ctlog: f.close() def update_sth(self): - new_sth = get_sth(self.url) + try: + new_sth = get_sth(self.url) + except Exception, e: + self.log("Failed to fetch STH. " +str(e)) + return try: check_sth_signature(self.url, new_sth, None) @@ -135,7 +143,12 @@ class ctlog: def update_roots(self): - roots = get_all_roots(self.url) + try: + roots = get_all_roots(self.url) + except Exception, e: + self.log("Failed to fetch roots. " + str(e)) + return + new_root_hash = str(hash(str(roots))) if new_root_hash != self.root_hash: @@ -183,8 +196,6 @@ class ctlog: else: self.log("WTF? Not a root...") - - def verify_progress(self, old): new = self.sth try: @@ -219,7 +230,6 @@ class ctlog: self.log(s) print s - def verify_consistency(self, old): new = self.sth # for url in old: -- cgit v1.1