From 1a20e5d01b46d3b1671e8be4aff8b9048d8467d9 Mon Sep 17 00:00:00 2001 From: Zooko O'Whielacronx Date: Fri, 30 Mar 2007 17:12:07 -0700 Subject: [PATCH] fix storage server to handle the case that it has no directory at all when someone asks for buckets --- src/allmydata/storageserver.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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 -- 2.45.2