diff options
author | Josef Gustafsson <josef.gson@gmail.com> | 2015-09-24 10:08:38 +0200 |
---|---|---|
committer | Josef Gustafsson <josef.gson@gmail.com> | 2015-09-24 10:08:38 +0200 |
commit | 9dd7093009e1e8b496741b7358a33f6eb91ebc88 (patch) | |
tree | a7235dfb89189e43caf17fe0e031955ac6244792 /monitor/josef_monitor.py | |
parent | 132d8db9afd1a58f436d297ba00584486e7a89ed (diff) |
monitor error handling for unavailable services
Diffstat (limited to 'monitor/josef_monitor.py')
-rwxr-xr-x | monitor/josef_monitor.py | 22 |
1 files changed, 16 insertions, 6 deletions
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: |