From: robk-tahoe Date: Thu, 25 Sep 2008 03:11:49 +0000 (-0700) Subject: manhole: be more tolerant of authorized_keys. files in .tahoe X-Git-Url: https://git.rkrishnan.org/components/com_hotproperty/%22doc.html/readonly?a=commitdiff_plain;h=90e3f3717339ec5fc9db62fd2d215c19b11a79b0;p=tahoe-lafs%2Ftahoe-lafs.git 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. --- 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())