From cb6762d12efe90fe04244845c940dda4b7cc5ba6 Mon Sep 17 00:00:00 2001 From: Rishabh Dave Date: Mon, 6 Apr 2026 11:51:06 +0530 Subject: [PATCH] pybind/cephfs: make should_cancel option parameter for rmtree() Make it optional to pass a function reference for should_cancel parameter of rmtree function by defining a default value for it. Right now one has to pass a simple lambda function returning False if one wants to make rmtree operation uninterruptible - rmtree('some-dir', should_cancel=lambda: False) With should_cancel's default value set to "lambda: False", the call is much simplied - rmtree('some-dir') Fixes: https://tracker.ceph.com/issues/75926 Signed-off-by: Rishabh Dave --- src/pybind/cephfs/cephfs.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pybind/cephfs/cephfs.pyx b/src/pybind/cephfs/cephfs.pyx index fef4ac6d760f..337b2e0b4182 100644 --- a/src/pybind/cephfs/cephfs.pyx +++ b/src/pybind/cephfs/cephfs.pyx @@ -3130,7 +3130,7 @@ cdef class LibCephFS(object): finally: free(buf) - def rmtree(self, trash_path, should_cancel, suppress_errors=False): + def rmtree(self, trash_path, should_cancel=lambda: False, suppress_errors=False): ''' Delete entire file hierarchy present under trash_path when trash_path is a dir. Do this deletion using depth-first (to prevent excessive memory -- 2.47.3