summaryrefslogtreecommitdiff
path: root/subplot/client.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/client.py
parent650b7cee5700eae9ab6c300fbdb816dead6f01f5 (diff)
downloadobnam2-8efabc60f87e5462b01f4832d575f68382929624.tar.gz
feat: verify checksum of chunks downloaded from server
Diffstat (limited to 'subplot/client.py')
-rw-r--r--subplot/client.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/subplot/client.py b/subplot/client.py
index c1f5159..53c7f6e 100644
--- a/subplot/client.py
+++ b/subplot/client.py
@@ -50,6 +50,13 @@ def run_obnam_restore_with_genref(ctx, filename=None, genref=None, todir=None):
)
+def run_obnam_get_chunk(ctx, filename=None, gen_id=None, todir=None):
+ runcmd_run = globals()["runcmd_run"]
+ gen_id = ctx["vars"][gen_id]
+ logging.debug(f"run_obnam_get_chunk: gen_id={gen_id}")
+ runcmd_run(ctx, ["obnam", "--config", filename, "get-chunk", gen_id])
+
+
def capture_generation_id(ctx, varname=None):
runcmd_get_stdout = globals()["runcmd_get_stdout"]
@@ -95,3 +102,11 @@ def get_backup_reason(ctx, filename):
lines = [line for line in lines if filename in line]
line = lines[0]
return line.split()[-1]
+
+
+def stdout_matches_file(ctx, filename=None):
+ runcmd_get_stdout = globals()["runcmd_get_stdout"]
+ assert_eq = globals()["assert_eq"]
+ stdout = runcmd_get_stdout(ctx)
+ data = open(filename).read()
+ assert_eq(stdout, data)