fix storage server to handle the case that it has no directory at all when someone...
authorZooko O'Whielacronx <zooko@zooko.com>
Sat, 31 Mar 2007 00:12:07 +0000 (17:12 -0700)
committerZooko O'Whielacronx <zooko@zooko.com>
Sat, 31 Mar 2007 00:12:07 +0000 (17:12 -0700)
src/allmydata/storageserver.py

index 764ba32b953a6a913ade36d49c999b9d78c758e0..426b8aec8b35e000dae7b171cfc0b8f6da0e7170 100644 (file)
@@ -116,7 +116,12 @@ class StorageServer(service.MultiService, Referenceable):
     def remote_get_buckets(self, verifierid):
         bucketreaders = {} # k: sharenum, v: BucketReader
         verifierdir = os.path.join(self.storedir, idlib.b2a(verifierid))
-        for f in os.listdir(verifierdir):
-            _assert(NUM_RE.match(f), f)
-            bucketreaders[int(f)] = BucketReader(os.path.join(verifierdir, f))
+        try:
+            for f in os.listdir(verifierdir):
+                _assert(NUM_RE.match(f), f)
+                bucketreaders[int(f)] = BucketReader(os.path.join(verifierdir, f))
+        except OSError:
+            # Commonly caused by there being no buckets at all.
+            pass
+
         return bucketreaders