Fixes to Magic Folder client initialization.
authorDaira Hopwood <daira@jacaranda.org>
Mon, 6 Jul 2015 23:34:17 +0000 (00:34 +0100)
committerDaira Hopwood <daira@jacaranda.org>
Wed, 30 Sep 2015 15:45:23 +0000 (16:45 +0100)
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
src/allmydata/client.py

index 9c47774ad264605c2a7be909a4a5731de5351169..dd5f8be98fea8577c28593763c78e8c3289ee669 100644 (file)
@@ -498,31 +498,23 @@ class Client(node.Node, pollmixin.PollMixin):
                                        "See docs/frontends/magic-folder.rst for more information.")
 
         if self.get_config("magic_folder", "enabled", False, boolean=True):
-            upload_dircap = self.get_or_create_private_config("magic_folder_dircap")
-            upload_dircap is not None
-            # XXX correcto?
-            #local_dir_config = self.get_config("magic_folder", "local.directory").decode("utf-8")
+            upload_dircap = self.get_private_config("magic_folder_dircap")
+            collective_dircap = self.get_private_config("collective_dircap")
+
             local_dir_config = self.get_config("magic_folder", "local.directory").decode("utf-8")
             local_dir = abspath_expanduser_unicode(local_dir_config, base=self.basedir)
 
-            try:
-                from allmydata.frontends import magic_folder
-                dbfile = os.path.join(self.basedir, "private", "magicfolderdb.sqlite")
-                dbfile = abspath_expanduser_unicode(dbfile)
+            dbfile = os.path.join(self.basedir, "private", "magicfolderdb.sqlite")
+            dbfile = abspath_expanduser_unicode(dbfile)
 
-                collective_dircap_path = os.path.join(self.basedir, "private", "collective_dircap")
-                collective_dircap_path = abspath_expanduser_unicode(collective_dircap_path)
-                collective_dircap = fileutil.read(collective_dircap_path).strip()
-                assert collective_dircap is not None
+            from allmydata.frontends import magic_folder
 
-                s = magic_folder.MagicFolder(self, upload_dircap, collective_dircap, local_dir, dbfile)
-                s.setServiceParent(self)
-                s.startService()
+            s = magic_folder.MagicFolder(self, upload_dircap, collective_dircap, local_dir, dbfile)
+            s.setServiceParent(self)
+            s.startService()
 
-                # start processing the upload queue when we've connected to enough servers
-                self.upload_ready_d.addCallback(s.ready)
-            except Exception, e:
-                self.log("couldn't start Magic Folder: %r", args=(e,))
+            # start processing the upload queue when we've connected to enough servers
+            self.upload_ready_d.addCallback(s.ready)
 
     def _check_exit_trigger(self, exit_trigger_file):
         if os.path.exists(exit_trigger_file):