From: John Mulligan Date: Sat, 18 Nov 2023 18:07:57 +0000 (-0500) Subject: cephadm: replace some calls to rm with fs function calls X-Git-Tag: v19.3.0~284^2~11 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=50928d56dd83b60526124abc37de8d7adf9cfe94;p=ceph.git cephadm: replace some calls to rm with fs function calls This should be a little cleaner, perhaps a tiny performance improvement, and most importantly work better with the virtual-fs provided for the unit tests and make this function more testable in the future. Signed-off-by: John Mulligan --- diff --git a/src/cephadm/cephadm.py b/src/cephadm/cephadm.py index c44dfbecbde..99791a2de67 100755 --- a/src/cephadm/cephadm.py +++ b/src/cephadm/cephadm.py @@ -4178,7 +4178,7 @@ def command_rm_daemon(ctx): os.rename(data_dir, os.path.join(backup_dir, dirname)) else: - call_throws(ctx, ['rm', '-rf', data_dir]) + shutil.rmtree(data_dir, ignore_errors=True) endpoints = fetch_endpoints(ctx) ports: List[int] = [e.port for e in endpoints]