record our nodeid (for reference) in 'my_nodeid'
authorBrian Warner <warner@allmydata.com>
Tue, 5 Dec 2006 23:40:48 +0000 (16:40 -0700)
committerBrian Warner <warner@allmydata.com>
Tue, 5 Dec 2006 23:40:48 +0000 (16:40 -0700)
allmydata/node.py

index 1af8a3c3087e909a85d1d0df6f420e5fc6f322c2..bbb03e330fddfeeb845357a7844f902c8c5bb6a8 100644 (file)
@@ -13,6 +13,7 @@ class Node(service.MultiService):
     PORTNUMFILE = None
     CERTFILE = None
     LOCAL_IP_FILE = "local_ip"
+    NODEIDFILE = "my_nodeid"
 
     def __init__(self, basedir="."):
         service.MultiService.__init__(self)
@@ -29,6 +30,9 @@ class Node(service.MultiService):
             f.write(self.tub.getCertData())
             f.close()
         self.nodeid = idlib.a2b(self.tub.tubID)
+        f = open(os.path.join(self.basedir, self.NODEIDFILE), "w")
+        f.write(idlib.b2a(self.nodeid) + "\n")
+        f.close()
         self.short_nodeid = self.tub.tubID[:4] # ready for printing
         portnum = 0
         assert self.PORTNUMFILE, "Your node.Node subclass must provide PORTNUMFILE"