summaryrefslogtreecommitdiff
path: root/tools/mergetools.py
diff options
context:
space:
mode:
authorMagnus Ahltorp <map@kth.se>2016-11-02 13:10:37 +0100
committerMagnus Ahltorp <map@kth.se>2016-11-02 13:10:37 +0100
commitb48c1689e36bdcc65a34b4ab12763478b072a716 (patch)
treef812f21492567b97aecba2c80dc0ce97a8e6eb6a /tools/mergetools.py
parent6659a1c08dda0d6ec20f945e135b23b544db55a4 (diff)
Change algorithm for merge backup and merge dist
Diffstat (limited to 'tools/mergetools.py')
-rw-r--r--tools/mergetools.py25
1 files changed, 22 insertions, 3 deletions
diff --git a/tools/mergetools.py b/tools/mergetools.py
index bea09e9..ff3d08c 100644
--- a/tools/mergetools.py
+++ b/tools/mergetools.py
@@ -214,6 +214,25 @@ def get_curpos(node, baseurl, own_key, paths):
print >>sys.stderr, "ERROR: currentposition", e.response
sys.exit(1)
+def get_frontend_verifiedsize(node, baseurl, own_key, paths):
+ return frontend_verify_entries(node, baseurl, own_key, paths, 0)
+
+def frontend_verify_entries(node, baseurl, own_key, paths, size):
+ try:
+ arguments = {"verify_to": size}
+ result = http_request(baseurl + "plop/v1/frontend/verify-entries",
+ json.dumps(arguments),
+ key=own_key, verifynode=node,
+ publickeydir=paths["publickeys"])
+ parsed_result = json.loads(result)
+ if parsed_result.get(u"result") == u"ok":
+ return parsed_result[u"verified"]
+ print >>sys.stderr, "ERROR: verify-entries", parsed_result
+ sys.exit(1)
+ except requests.exceptions.HTTPError, e:
+ print >>sys.stderr, "ERROR: verify-entries", e.response
+ sys.exit(1)
+
def get_verifiedsize(node, baseurl, own_key, paths):
try:
result = http_request(baseurl + "plop/v1/merge/verifiedsize",
@@ -319,14 +338,14 @@ def sendentries_merge(node, baseurl, own_key, paths, entries, session=None):
print >>sys.stderr, "ERROR: sendentries_merge", baseurl, e.request, e.response
sys.exit(1)
-def sendsth(node, baseurl, own_key, paths, submission):
+def publish_sth(node, baseurl, own_key, paths, submission):
try:
- result = http_request(baseurl + "plop/v1/frontend/sendsth",
+ result = http_request(baseurl + "plop/v1/frontend/publish-sth",
json.dumps(submission), key=own_key,
verifynode=node, publickeydir=paths["publickeys"])
return json.loads(result)
except requests.exceptions.HTTPError, e:
- print >>sys.stderr, "ERROR: sendsth", e.response
+ print >>sys.stderr, "ERROR: publish-sth", e.response
sys.exit(1)
except ValueError, e:
print >>sys.stderr, "==== FAILED REQUEST ===="