]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: rm-cluster clean up /etc/ceph 34299/head
authorDaniel-Pivonka <dpivonka@redhat.com>
Tue, 24 Mar 2020 19:31:21 +0000 (15:31 -0400)
committerSage Weil <sage@redhat.com>
Mon, 30 Mar 2020 20:22:42 +0000 (15:22 -0500)
rm-cluster command will delete config, keyring, and pub key files from /etc/ceph

Signed-off-by: Daniel-Pivonka <dpivonka@redhat.com>
(cherry picked from commit b3f69b10dfa269b29fe417c47189d1dc7608a407)

src/cephadm/cephadm

index baccd7c050514e5385cab8f8af7d5f7636424dd6..5f1ad2ca938b65ddfe69a23ecad378f2c7d38b46 100755 (executable)
@@ -3283,6 +3283,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])
+
 
 ##################################