From e7f18920bab889c67625607bd3cf4a56dfe685f9 Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Tue, 21 Oct 2014 18:34:52 +0100 Subject: [PATCH] Some minor refactorings for clearer code. Signed-off-by: Daira Hopwood --- src/allmydata/scripts/startstop_node.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/allmydata/scripts/startstop_node.py b/src/allmydata/scripts/startstop_node.py index 74c9b4b9..de72cc35 100644 --- a/src/allmydata/scripts/startstop_node.py +++ b/src/allmydata/scripts/startstop_node.py @@ -86,16 +86,11 @@ def identify_node_type(basedir): break else: return None - if "client" in tac: - return "client" - elif "introducer" in tac: - return "introducer" - elif "key-generator" in tac: - return "key-generator" - elif "stats-gatherer" in tac: - return "stats-gatherer" - else: - return None + + for t in ("client", "introducer", "key-generator", "stats-gatherer"): + if t in tac: + return t + return None def start(config, out=sys.stdout, err=sys.stderr): basedir = config['basedir'] @@ -151,9 +146,11 @@ def start(config, out=sys.stdout, err=sys.stderr): # For Tahoe, we don't need to do anything with the child, so we can just # let it exit. - verb = "starting" if "--nodaemon" in twistd_args: verb = "running" + else: + verb = "starting" + print >>out, "%s node in %s" % (verb, basedir) twistd.runApp(twistd_config) # we should only reach here if --nodaemon or equivalent was used -- 2.45.2