From 2dd0179e25a2366067906979579a1cd797fd1b37 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Tue, 31 Jan 2023 17:05:30 +1300 Subject: [PATCH] fix lint --- livefs_edit/actions.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/livefs_edit/actions.py b/livefs_edit/actions.py index ba18986..106cf64 100644 --- a/livefs_edit/actions.py +++ b/livefs_edit/actions.py @@ -174,23 +174,27 @@ def install_debs(ctxt, debs: List[str] = ()): run(['umount', rootfs_path]) os.unlink(rootfs_path) + def rm_ro(func, path, _): """Clear readonly attribute and retry removal""" os.chmod(path, stat.S_IWRITE) func(path) + def rm_f(path): if os.path.exists(path): if os.path.isdir(path): - shutil.rmtree(path, onerror = rm_ro) + shutil.rmtree(path, onerror=rm_ro) else: os.chmod(path, stat.S_IWRITE) os.unlink(path) + @register_action() def rm(ctxt, path): rm_f(ctxt.p(path, allow_abs=True)) + def download_snap(ctxt, snap_name, channel): dldir = ctxt.tmpdir() run([