From 90e3f3717339ec5fc9db62fd2d215c19b11a79b0 Mon Sep 17 00:00:00 2001 From: robk-tahoe Date: Wed, 24 Sep 2008 20:11:49 -0700 Subject: [PATCH] manhole: be more tolerant of authorized_keys. files in .tahoe both peter and I independently tried to do the same thing to eliminate the authorized_keys file which was causing problems with the broken mac build (c.f. #522) namely mv authorized_keys.8223{,.bak} but the node is, ahem, let's say 'intolerant' of the trailing .bak - rather than disable the manhole as one might expect, it instead causes the node to explode on startup. this patch makes it skip over anything that doesn't pass the 'parse this trailing stuff as an int' test. --- src/allmydata/node.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/allmydata/node.py b/src/allmydata/node.py index 2f81ab19..310be291 100644 --- a/src/allmydata/node.py +++ b/src/allmydata/node.py @@ -92,11 +92,15 @@ class Node(service.MultiService): for f in os.listdir(self.basedir): if f.startswith(AUTHKEYSFILEBASE): keyfile = os.path.join(self.basedir, f) - portnum = int(f[len(AUTHKEYSFILEBASE):]) - from allmydata import manhole - m = manhole.AuthorizedKeysManhole(portnum, keyfile) - m.setServiceParent(self) - self.log("AuthorizedKeysManhole listening on %d" % portnum) + try: + portnum = int(f[len(AUTHKEYSFILEBASE):]) + except ValueError: + self.log("AuthorizedKeysManhole malformed file name %s" % (f,)) + else: + from allmydata import manhole + m = manhole.AuthorizedKeysManhole(portnum, keyfile) + m.setServiceParent(self) + self.log("AuthorizedKeysManhole listening on %d" % portnum) self.setup_logging() self.log("Node constructed. " + get_package_versions_string()) -- 2.45.2