[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[minion-cvs] Add a command for directory servers to regenerate ident...
Update of /home/minion/cvsroot/src/minion/lib/mixminion/directory
In directory moria.mit.edu:/tmp/cvs-serv29117/lib/mixminion/directory
Modified Files:
DirMain.py ServerList.py
Log Message:
Add a command for directory servers to regenerate identity caches.
Otherwise, there's no way for me to take servers out of the directory.
A better way will appear when real directories happen.
Index: DirMain.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/directory/DirMain.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- DirMain.py 6 Jun 2003 06:04:58 -0000 1.16
+++ DirMain.py 20 Oct 2003 19:40:32 -0000 1.17
@@ -90,6 +90,15 @@
inbox = d.getInbox()
inbox.listNewPendingServers(sys.stdout)
+def cmd_rebuildcache(args):
+ """DOCDOC"""
+ if args:
+ raise UIError("mixminion dir rebuildcache takes no arguments")
+ d = getDirectory()
+ serverList = d.getServerList()
+ serverList.rebuildIDCache()
+ d.getIDCache().save()
+
def cmd_import(args):
"""[Entry point] Import descriptors for new servers, by nickname."""
d = getDirectory()
@@ -178,7 +187,8 @@
'list' : cmd_list,
'import-new' : cmd_import,
'generate' : cmd_generate,
- 'fingerprint' : cmd_fingerprint
+ 'fingerprint' : cmd_fingerprint,
+ 'rebuildcache' : cmd_rebuildcache
}
def main(cmd, args):
Index: ServerList.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/directory/ServerList.py,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- ServerList.py 12 Sep 2003 15:48:19 -0000 1.40
+++ ServerList.py 20 Oct 2003 19:40:32 -0000 1.41
@@ -131,6 +131,17 @@
finally:
self._unlock()
+ def rebuildIDCache(self):
+ for fn in os.listdir(self.serverIDDir):
+ fname = os.path.join(self.serverIDDir, fn)
+ tp,val = readPickled(fname)
+ if tp != "V0":
+ LOG.warn("Weird file version %s on %s",tp,fname)
+ continue
+ nickname, ident = val
+ ID = mixminion.Crypto.sha1(ident)
+ self.idCache.insertID(nickname, ID)
+
def learnServerID(self, server):
"""Mark the ID for a server descriptor as the canonical
identity key associated with that server's nickname."""