commit 1a087d7760c317675c3c21cfe26d197803304da1 Author: Arturo Filastò art@fuffa.org Date: Tue Aug 27 11:00:19 2013 +0200
Properly handle the case when we don't get a collector by asking a bouncer --- ooni/oonicli.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/ooni/oonicli.py b/ooni/oonicli.py index fb333c7..c511aa0 100644 --- a/ooni/oonicli.py +++ b/ooni/oonicli.py @@ -156,14 +156,15 @@ def runWithDirector(): def setup_nettest(_): try: return deck.setup() - except errors.UnableToLoadDeckInput, e: - return defer.failure.Failure(result) + except errors.UnableToLoadDeckInput as error: + return defer.failure.Failure(error)
def director_startup_failed(failure): log.err("Failed to start the director") r = failure.trap(errors.TorNotRunning, errors.InvalidOONIBCollectorAddress, - errors.UnableToLoadDeckInput, errors.CouldNotFindTestHelper) + errors.UnableToLoadDeckInput, errors.CouldNotFindTestHelper, + errors.CouldNotFindTestCollector)
if isinstance(failure.value, errors.TorNotRunning): log.err("Tor does not appear to be running") @@ -184,6 +185,11 @@ def runWithDirector(): log.err("Unable to obtain the required test helpers.") log.msg("Try with a different bouncer or check that Tor is running properly.")
+ elif isinstance(failure.value, errors.CouldNotFindTestCollector): + log.err("Could not find a valid collector.") + log.msg("Try with a different bouncer, specify a collector with -c or disable reporting to a collector with -n.") + + if config.advanced.debug: log.exception(failure)
tor-commits@lists.torproject.org