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>
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