[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[minion-cvs] Give the server admin a file containing names of curren...



Update of /home/minion/cvsroot/src/minion/lib/mixminion/server
In directory moria.mit.edu:/tmp/cvs-serv9645/lib/mixminion/server

Modified Files:
	ServerKeys.py ServerMain.py 
Log Message:
Give the server admin a file containing names of current descriptors

Index: ServerKeys.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/ServerKeys.py,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- ServerKeys.py	29 May 2003 02:15:01 -0000	1.32
+++ ServerKeys.py	29 May 2003 05:47:32 -0000	1.33
@@ -32,7 +32,7 @@
 from mixminion.Common import AtomicFile, LOG, MixError, MixFatalError, \
      ceilDiv, createPrivateDir, \
      checkPrivateFile, formatBase64, formatDate, formatTime, previousMidnight,\
-     secureDelete
+     secureDelete, writeFile
 
 #----------------------------------------------------------------------
 
@@ -411,7 +411,7 @@
                                                    keys.getMMTPKey(),
                                                    self._getDHFile())
 
-    def updateKeys(self, packetHandler, mmtpServer, when=None):
+    def updateKeys(self, packetHandler, mmtpServer, statusFile=None,when=None):
         """DOCDOC: Return next rotation."""
         self.removeDeadKeys()
         self.currentKeys = keys = self.getServerKeysets(when)
@@ -429,6 +429,11 @@
                     k.getHashLogFileName(), k.getPacketKeyID()))
             packetHandler.setKeys(packetKeys, hashLogs)
 
+        if statusFile:
+            writeFile(statusFile,
+                    "".join(["%s\n"%k.getDescriptorFileName() for k in keys]),
+                    0644)
+
         self.nextUpdate = None
         self.getNextKeyRotation(keys)
 
@@ -693,7 +698,7 @@
 
     config_s = config['Server']
     info_s = info['Server']
-    if config_s['Nickname'] and (info_s['Nickname'] != config_s['Nickname']):
+    if info_s['Nickname'] != config_s['Nickname']:
         warn("Mismatched nicknames: %s in configuration; %s published.",
              config_s['Nickname'], info_s['Nickname'])
 
@@ -806,11 +811,6 @@
 
     # Now, we pull all the information we need from our configuration.
     nickname = config['Server']['Nickname']
-    if not nickname:
-        nickname = socket.gethostname()
-        if not nickname or nickname.lower().startswith("localhost"):
-            nickname = config['Incoming/MMTP'].get('IP', "<Unknown host>")
-        LOG.warn("No nickname given: defaulting to %r", nickname)
     contact = config['Server']['Contact-Email']
     comments = config['Server']['Comments']
     if not now:

Index: ServerMain.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/ServerMain.py,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- ServerMain.py	29 May 2003 02:01:34 -0000	1.62
+++ ServerMain.py	29 May 2003 05:47:32 -0000	1.63
@@ -31,6 +31,7 @@
 #                              published [present if this desc is published]
 #                     key_0002/...
 #                conf/miniond.conf [configuration file]
+#                current-desc
 #                stats [DOCDOC]
 #                version [DOCDOC]
 
@@ -654,7 +655,9 @@
         LOG.debug("Initializing MMTP server")
         self.mmtpServer = _MMTPServer(config, None)
         LOG.debug("Initializing keys")
-        self.keyring.updateKeys(self.packetHandler, self.mmtpServer)
+        self.descriptorFile = os.path.join(homeDir, "current-desc")
+        self.keyring.updateKeys(self.packetHandler, self.mmtpServer,
+                                self.descriptorFile)
 
         publishedIP, publishedPort, publishedKeyID = self.keyring.getAddress()
 
@@ -718,7 +721,8 @@
             return time.time() + 120
 
         try:
-            self.keyring.updateKeys(self.packetHandler, self.mmtpServer)
+            self.keyring.updateKeys(self.packetHandler, self.mmtpServer,
+                                    self.descriptorFile)
             return self.keyring.getNextKeyRotation()
         finally:
             if lock: self.keyring.unlock()