From: Rishabh Dave Date: Mon, 6 Apr 2026 06:21:06 +0000 (+0530) Subject: pybind/cephfs: make should_cancel option parameter for rmtree() X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cb6762d12efe90fe04244845c940dda4b7cc5ba6;p=ceph.git 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 --- 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