From 0fcb8f314a054e4c92e49461f1ae2d9392756638 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Fri, 12 Mar 2021 11:12:46 +0200 Subject: feat: show warnings for any problems backing up files Previously, we either ignored it or aborted the backup. Neither is good. Now we ignore the problem, except to show a warning at the end of the backup run. --- subplot/client.py | 5 +++++ subplot/client.yaml | 1 + subplot/data.py | 6 +++++- 3 files changed, 11 insertions(+), 1 deletion(-) (limited to 'subplot') diff --git a/subplot/client.py b/subplot/client.py index 0e724b8..966324e 100644 --- a/subplot/client.py +++ b/subplot/client.py @@ -11,6 +11,11 @@ def install_obnam(ctx): runcmd_prepend_to_path(ctx, dirname=os.path.join(srcdir, "target", "debug")) +def uninstall_obnam(ctx): + runcmd_run = globals()["runcmd_run"] + runcmd_run(ctx, ["chmod", "-R", "u+rwX", "."]) + + def configure_client(ctx, filename=None): get_file = globals()["get_file"] diff --git a/subplot/client.yaml b/subplot/client.yaml index eef4714..b76b96a 100644 --- a/subplot/client.yaml +++ b/subplot/client.yaml @@ -1,5 +1,6 @@ - given: "an installed obnam" function: install_obnam + cleanup: uninstall_obnam - given: "a client config based on {filename}" function: configure_client diff --git a/subplot/data.py b/subplot/data.py index 9396215..1455bf4 100644 --- a/subplot/data.py +++ b/subplot/data.py @@ -73,7 +73,11 @@ def file_is_restored(ctx, filename=None, restored=None): def file_is_not_restored(ctx, filename=None, restored=None): filename = os.path.join(restored, "./" + filename) - exists = os.path.exists(filename) + logging.info(r"verifying that {filename} does not exist") + try: + exists = os.path.exists(filename) + except PermissionError: + exists = False logging.debug(f"restored? {filename} {exists}") assert not exists -- cgit v1.2.1