From: Brian Warner Date: Wed, 20 Mar 2013 22:25:10 +0000 (-0700) Subject: client.py: throw error when reserved_space= is unparseable. Closes #1812. X-Git-Tag: allmydata-tahoe-1.10a2~5 X-Git-Url: https://git.rkrishnan.org/pf/statistics?a=commitdiff_plain;h=b084396bddd1e12a5e49ed4e9f1a2eafcbe8e01b;p=tahoe-lafs%2Ftahoe-lafs.git client.py: throw error when reserved_space= is unparseable. Closes #1812. This should now fail quickly (during "tahoe start"). Previously this would silently treat an unparseable size as "0", and the only way to discover that it had had a problem would be to look at the foolscap log, or examine the storage-service web page for the unexpected "Reserved Size" number. --- diff --git a/src/allmydata/client.py b/src/allmydata/client.py index ad804248..23ca8b3d 100644 --- a/src/allmydata/client.py +++ b/src/allmydata/client.py @@ -257,12 +257,12 @@ class Client(node.Node, pollmixin.PollMixin): storedir = os.path.join(self.basedir, self.STOREDIR) data = self.get_config("storage", "reserved_space", None) - reserved = None try: reserved = parse_abbreviated_size(data) except ValueError: log.msg("[storage]reserved_space= contains unparseable value %s" % data) + raise if reserved is None: reserved = 0 discard = self.get_config("storage", "debug_discard", False, diff --git a/src/allmydata/test/test_client.py b/src/allmydata/test/test_client.py index ec713abc..61d08603 100644 --- a/src/allmydata/test/test_client.py +++ b/src/allmydata/test/test_client.py @@ -132,8 +132,7 @@ class Basic(testutil.ReallyEqualMixin, unittest.TestCase): "[storage]\n" + \ "enabled = true\n" + \ "reserved_space = bogus\n") - c = client.Client(basedir) - self.failUnlessEqual(c.getServiceNamed("storage").reserved_space, 0) + self.failUnlessRaises(ValueError, client.Client, basedir) def _permute(self, sb, key): return [ s.get_longname() for s in sb.get_servers_for_psi(key) ]