summaryrefslogtreecommitdiff
path: root/subplot/server.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-01-04 18:57:49 +0200
committerLars Wirzenius <liw@liw.fi>2021-01-04 20:02:06 +0200
commit8efabc60f87e5462b01f4832d575f68382929624 (patch)
tree422b3941b6867871486df2198aef0e431c6b95ac /subplot/server.py
parent650b7cee5700eae9ab6c300fbdb816dead6f01f5 (diff)
downloadobnam2-8efabc60f87e5462b01f4832d575f68382929624.tar.gz
feat: verify checksum of chunks downloaded from server
Diffstat (limited to 'subplot/server.py')
-rw-r--r--subplot/server.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/subplot/server.py b/subplot/server.py
index 5cc9d9b..289e181 100644
--- a/subplot/server.py
+++ b/subplot/server.py
@@ -90,6 +90,16 @@ def delete_chunk_by_id(ctx, chunk_id=None):
_request(ctx, requests.delete, url)
+def make_chunk_file_be_empty(ctx, chunk_id=None):
+ chunk_id = ctx["vars"][chunk_id]
+ chunks = ctx["config"]["chunks"]
+ for (dirname, _, _) in os.walk(chunks):
+ filename = os.path.join(dirname, chunk_id + ".data")
+ if os.path.exists(filename):
+ logging.debug(f"emptying chunk file {filename}")
+ open(filename, "w").close()
+
+
def status_code_is(ctx, status=None):
assert_eq = globals()["assert_eq"]
assert_eq(ctx["http.status"], int(status))