diff options
Diffstat (limited to 'tools/mergestatus.py')
-rwxr-xr-x | tools/mergestatus.py | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tools/mergestatus.py b/tools/mergestatus.py new file mode 100755 index 0000000..80d755e --- /dev/null +++ b/tools/mergestatus.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2017, NORDUnet A/S. +# See LICENSE for licensing information. +# +import sys +import json +import urllib2 +import time +import requests +import base64 +from base64 import b64encode +from mergetools import parse_args, get_nfetched, hexencode, hexdecode, \ + get_logorder, get_sth +from certtools import create_ssl_context, get_public_key_from_file, \ + timing_point, create_sth_signature, write_file, check_sth_signature, \ + build_merkle_tree + +def main(): + args, config, localconfig = parse_args() + paths = localconfig["paths"] + mergenodes = config.get("mergenodes", []) + mergedb = paths["mergedb"] + sthfile = mergedb + "/sth" + currentsizefile = mergedb + "/fetched" + + sth = json.loads(open(sthfile, "r").read()) + currentsize = json.loads(open(currentsizefile, "r").read()) + + print >>sys.stderr, currentsize["index"]+1, + + for mergenode in mergenodes: + if mergenode["name"] == config["primarymergenode"]: + continue + verifiedfile = mergedb + "/verified." + mergenode["name"] + try: + tree = json.loads(open(verifiedfile, "r").read()) + print >>sys.stderr, tree["tree_size"], + except (IOError, ValueError): + pass + print >>sys.stderr, sth["tree_size"], + print + +if __name__ == '__main__': + sys.exit(main()) |