summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2016-12-01 13:09:53 +0100
committerLinus Nordberg <linus@nordu.net>2016-12-01 13:09:53 +0100
commit2fd16de0f29487b4b55d50631daf728953336db8 (patch)
treec4580ed6c9d942ad52f8c86600f61c7d33dba098
parent3abbd4a27979b0e4498b9bb955c715cda4123834 (diff)
Separate two error cases when reading 'verified' file.
-rwxr-xr-xtools/merge_sth.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/merge_sth.py b/tools/merge_sth.py
index 9dd7a70..c4220dc 100755
--- a/tools/merge_sth.py
+++ b/tools/merge_sth.py
@@ -47,8 +47,13 @@ def merge_sth(args, config, localconfig):
verifiedfile = mergedb + "/verified." + mergenode["name"]
try:
tree = json.loads(open(verifiedfile, "r").read())
- except (IOError, ValueError):
+ except IOError:
tree = {'tree_size': 0, "sha256_root_hash": ''}
+ except ValueError:
+ logging.error("corrupt verified file %s", verifiedfile)
+ return -1
+ logging.debug("adding tree_size %d from %s to trees", tree['tree_size'],
+ verifiedfile)
trees.append(tree)
trees.sort(key=lambda e: e['tree_size'], reverse=True)
logging.debug("trees: %s", trees)