summaryrefslogtreecommitdiffstats
path: root/src/cephadm/cephadm.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xsrc/cephadm/cephadm.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/cephadm/cephadm.py b/src/cephadm/cephadm.py
index 23352651f27..636c2161547 100755
--- a/src/cephadm/cephadm.py
+++ b/src/cephadm/cephadm.py
@@ -4326,25 +4326,30 @@ def _rm_cluster(ctx: CephadmContext, keep_logs: bool, zap_osds: bool) -> None:
shutil.rmtree(unit_dir / f'ceph-{ctx.fsid}.target.wants', ignore_errors=True)
# rm data
- call_throws(ctx, ['rm', '-rf', ctx.data_dir + '/' + ctx.fsid])
+ shutil.rmtree(Path(ctx.data_dir) / ctx.fsid, ignore_errors=True)
if not keep_logs:
# rm logs
- call_throws(ctx, ['rm', '-rf', ctx.log_dir + '/' + ctx.fsid])
+ shutil.rmtree(Path(ctx.log_dir) / ctx.fsid, ignore_errors=True)
# rm logrotate config
- call_throws(ctx, ['rm', '-f', ctx.logrotate_dir + '/ceph-%s' % ctx.fsid])
+ unlink_file(
+ Path(ctx.logrotate_dir) / ('ceph-%s' % ctx.fsid), ignore_errors=True
+ )
# if last cluster on host remove shared files
if get_ceph_cluster_count(ctx) == 0:
terminate_service(ctx, 'ceph.target')
# rm shared ceph target files
- call_throws(ctx, ['rm', '-f', ctx.unit_dir + '/multi-user.target.wants/ceph.target'])
- call_throws(ctx, ['rm', '-f', ctx.unit_dir + '/ceph.target'])
+ unlink_file(
+ Path(ctx.unit_dir) / 'multi-user.target.wants/ceph.target',
+ ignore_errors=True
+ )
+ unlink_file(Path(ctx.unit_dir) / 'ceph.target', ignore_errors=True)
# rm cephadm logrotate config
- call_throws(ctx, ['rm', '-f', ctx.logrotate_dir + '/cephadm'])
+ unlink_file(Path(ctx.logrotate_dir) / 'cephadm', ignore_errors=True)
if not keep_logs:
# remove all cephadm logs