From: Zooko O'Whielacronx Date: Sat, 31 Mar 2007 00:12:07 +0000 (-0700) Subject: fix storage server to handle the case that it has no directory at all when someone... X-Git-Url: https://git.rkrishnan.org/pf/content/en.html?a=commitdiff_plain;h=1a20e5d01b46d3b1671e8be4aff8b9048d8467d9;p=tahoe-lafs%2Ftahoe-lafs.git fix storage server to handle the case that it has no directory at all when someone asks for buckets --- diff --git a/src/allmydata/storageserver.py b/src/allmydata/storageserver.py index 764ba32b..426b8aec 100644 --- a/src/allmydata/storageserver.py +++ b/src/allmydata/storageserver.py @@ -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