]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
teach leave to: remove magic_folder section of config
authorDavid Stainton <dstainton415@gmail.com>
Tue, 10 Nov 2015 15:24:44 +0000 (16:24 +0100)
committerDaira Hopwood <daira@jacaranda.org>
Mon, 28 Dec 2015 16:18:55 +0000 (16:18 +0000)
src/allmydata/scripts/magic_folder_cli.py

index 098b2fcc42a22c1cb00da6f1861e38707f7f525f..1b7ff39a1babc0cbf5da79c4ea0c6067315bf6a0 100644 (file)
@@ -172,9 +172,19 @@ class LeaveOptions(BasedirOptions):
         BasedirOptions.parseArgs(self)
 
 def leave(options):
+    from ConfigParser import SafeConfigParser
+
     dmd_cap_file = os.path.join(options["node-directory"], u"private", u"magic_folder_dircap")
     collective_readcap_file = os.path.join(options["node-directory"], u"private", u"collective_dircap")
     magic_folder_db_file = os.path.join(options["node-directory"], u"private", u"magicfolderdb.sqlite")
+
+    parser = SafeConfigParser()
+    parser.read(os.path.join(options["node-directory"], u"tahoe.cfg"))
+    parser.remove_section("magic_folder")
+    f = open(os.path.join(options["node-directory"], u"tahoe.cfg"), "w")
+    parser.write(f)
+    f.close()
+
     for f in [dmd_cap_file, collective_readcap_file, magic_folder_db_file]:
         try:
             os.remove(f)