]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: rm-cluster clean up /etc/ceph 34150/head
authorDaniel-Pivonka <dpivonka@redhat.com>
Tue, 24 Mar 2020 19:31:21 +0000 (15:31 -0400)
committerDaniel-Pivonka <dpivonka@redhat.com>
Fri, 27 Mar 2020 14:03:03 +0000 (10:03 -0400)
rm-cluster command will delete config, keyring, and pub key files from /etc/ceph

Signed-off-by: Daniel-Pivonka <dpivonka@redhat.com>
src/cephadm/cephadm

index 79b11bc549af3b0ac2d87ed700e523ecc50e77c4..230d36aeb306f62b0bc6b4c0442868a1ab750493 100755 (executable)
@@ -3248,6 +3248,19 @@ def command_rm_cluster():
     # rm logrotate config
     call_throws(['rm', '-f', args.logrotate_dir + '/ceph-%s' % args.fsid])
 
+    # clean up config, keyring, and pub key files
+    files = ['/etc/ceph/ceph.conf', '/etc/ceph/ceph.pub', '/etc/ceph/ceph.client.admin.keyring']
+
+    if os.path.exists(files[0]):
+        valid_fsid = False
+        with open(files[0]) as f:
+            if args.fsid in f.read():
+                valid_fsid = True
+        if valid_fsid:
+            for n in range(0, len(files)):
+                if os.path.exists(files[n]):
+                    os.remove(files[n])
+
 
 ##################################