]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/cephfs: make should_cancel option parameter for rmtree()
authorRishabh Dave <ridave@redhat.com>
Mon, 6 Apr 2026 06:21:06 +0000 (11:51 +0530)
committerRishabh Dave <ridave@redhat.com>
Thu, 16 Apr 2026 12:41:08 +0000 (18:11 +0530)
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 <ridave@redhat.com>
src/pybind/cephfs/cephfs.pyx

index fef4ac6d760ff7e62181c8be05bcc73e687bd309..337b2e0b4182885952d4bc76e011e61936e1fcf1 100644 (file)
@@ -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