From: Brian Warner Date: Tue, 15 Apr 2008 06:42:20 +0000 (-0700) Subject: web: don't break status page when there is no helper running X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/uri/%22doc.html?a=commitdiff_plain;h=6de2a0794fe5f78d886ef75dce3e25b16dd9f393;p=tahoe-lafs%2Ftahoe-lafs.git web: don't break status page when there is no helper running --- diff --git a/src/allmydata/client.py b/src/allmydata/client.py index bcab4602..71fd6f62 100644 --- a/src/allmydata/client.py +++ b/src/allmydata/client.py @@ -371,9 +371,15 @@ class Client(node.Node, testutil.PollMixin): return watcher.list_recent_retrieve() def list_active_helper_statuses(self): - helper = self.getServiceNamed("helper") + try: + helper = self.getServiceNamed("helper") + except KeyError: + return [] return helper.get_active_upload_statuses() def list_recent_helper_statuses(self): - helper = self.getServiceNamed("helper") + try: + helper = self.getServiceNamed("helper") + except KeyError: + return [] return helper.get_recent_upload_statuses() diff --git a/src/allmydata/test/test_system.py b/src/allmydata/test/test_system.py index 1aa682a5..e25b4fb2 100644 --- a/src/allmydata/test/test_system.py +++ b/src/allmydata/test/test_system.py @@ -1347,8 +1347,13 @@ class SystemTest(testutil.SignalMixin, testutil.PollMixin, unittest.TestCase): d.addCallback(_got_helper_status_json) # and check that client[3] (which uses a helper but does not run one - # itself) doesn't explode when you ask for its helper status with - # t=json + # itself) doesn't explode when you ask for its status + d.addCallback(lambda res: getPage(self.helper_webish_url + "status/")) + def _got_non_helper_status(res): + self.failUnless("Upload and Download Status" in res) + d.addCallback(_got_non_helper_status) + + # or for helper status with t=json d.addCallback(lambda res: getPage(self.helper_webish_url + "helper_status?t=json")) def _got_non_helper_status_json(res):