]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
manhole: be more tolerant of authorized_keys. files in .tahoe
authorrobk-tahoe <robk-tahoe@allmydata.com>
Thu, 25 Sep 2008 03:11:49 +0000 (20:11 -0700)
committerrobk-tahoe <robk-tahoe@allmydata.com>
Thu, 25 Sep 2008 03:11:49 +0000 (20:11 -0700)
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

index 2f81ab194a25a8d755740c4c451a7460fd4c66b2..310be2911dd1664a22b77866cf6cec2cb575221a 100644 (file)
@@ -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())