]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Change behavior upon finding missing files
authorDavid Stainton <dstainton415@gmail.com>
Thu, 11 Jun 2015 21:24:06 +0000 (14:24 -0700)
committerDaira Hopwood <daira@jacaranda.org>
Mon, 20 Jul 2015 23:42:34 +0000 (00:42 +0100)
- Fix test test_magic_folder
- Do not throw exception for missing files...
- Check for entry in magic folder db; only write tahoe metadata
deleted=true if magic folder db entry for file exists.

src/allmydata/frontends/magic_folder.py
src/allmydata/test/test_magic_folder.py

index 68bb792de0e89da8466ede36ec61e28dff0cda50..29fd238ef0b7f8a54ba3607f72db6a4462ed97d0 100644 (file)
@@ -218,21 +218,20 @@ class MagicFolder(service.MultiService):
 
                 # XXX todo: check if file exists in magic folder db
                 # ...
-                if not self._db_file_is_uploaded(path):
-                    return NoSuchChildError("not uploading non-existent file")
+                if not self._db.check_file_db_exists(path):
+                    return None
                 else:
-                    # XXX ...
                     u = Data("", self._convergence)
-                    d2 = self._parent.add_file(name, u, overwrite=True)
+                    d2 = defer.Succeed(None)
                     def get_metadata(d):
                         return self._parent.get_metadata_for(name)
+                    d2.addCallback(get_metadata)
                     def set_deleted(metadata):
                         metadata['version'] += 1
                         metadata['deleted'] = True
-                        return self._parent.set_metadata_for(name, metadata)
-                    d2.addCallback(get_metadata)
+                        return self._parent.add_file(name, u, overwrite=True, metadata=metadata)
                     d2.addCallback(set_deleted)
-                    return NoSuchChildError("not uploading non-existent file")
+                    return d2
             elif os.path.islink(path):
                 raise Exception("symlink not being processed")
             if os.path.isdir(path):
index 80e2c8e99288414ae9a372167d0d7e7bc69181b5..e6edd93d31c11258221b0096117cd5a752615e52 100644 (file)
@@ -305,8 +305,6 @@ class MagicFolderTestMixin(GridTestMixin, ShouldFailMixin, ReallyEqualMixin, Non
         self.notify(path, self.inotify.IN_CLOSE_WRITE)
 
         if temporary:
-            d.addCallback(lambda ign: self.shouldFail(NoSuchChildError, 'temp file not uploaded', None,
-            self.upload_dirnode.get, name_u))
             d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.objects_disappeared'),
                                                                  previously_disappeared + 1))
         else: