]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: replace some calls to rm with fs function calls
authorJohn Mulligan <jmulligan@redhat.com>
Sat, 18 Nov 2023 18:07:57 +0000 (13:07 -0500)
committerJohn Mulligan <jmulligan@redhat.com>
Tue, 2 Jan 2024 14:30:21 +0000 (09:30 -0500)
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 <jmulligan@redhat.com>
src/cephadm/cephadm.py

index c44dfbecbde38e756d87d84ac444ab5d22ad5f8a..99791a2de679173c3b0b78ec2e60e95721368830 100755 (executable)
@@ -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]