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

[minion-cvs] Reduce pychecker warnings, fixing a few typos in the pr...



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

Modified Files:
	MMTPServer.py Modules.py ServerKeys.py ServerMain.py 
	ServerQueue.py 
Log Message:
Reduce pychecker warnings, fixing a few typos in the process

Index: MMTPServer.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/MMTPServer.py,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- MMTPServer.py	26 May 2003 20:04:24 -0000	1.29
+++ MMTPServer.py	28 May 2003 06:37:37 -0000	1.30
@@ -267,7 +267,7 @@
         if address is not None:
             self.address = "%s (fd %s)" % (address, self.fd)
         else:
-            self.address = "remote host (fd %s)" % (address, self.fd)
+            self.address = "remote host (fd %s)" % self.fd
 
     def isShutdown(self):
         """Returns true iff this connection is finished shutting down"""

Index: Modules.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/Modules.py,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- Modules.py	26 May 2003 20:04:25 -0000	1.38
+++ Modules.py	28 May 2003 06:37:43 -0000	1.39
@@ -28,9 +28,9 @@
 import mixminion.BuildMessage
 import mixminion.Config
 import mixminion.Packet
-import mixminion.server.EventStats as EventStats
 import mixminion.server.ServerQueue
 import mixminion.server.ServerConfig
+import mixminion.server.EventStats as EventStats
 from mixminion.Config import ConfigError, _parseBoolean, _parseCommand, \
      _parseIntervalList
 from mixminion.Common import LOG, createPrivateDir, MixError, isSMTPMailbox, \

Index: ServerKeys.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/ServerKeys.py,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- ServerKeys.py	28 May 2003 04:53:34 -0000	1.25
+++ ServerKeys.py	28 May 2003 06:37:43 -0000	1.26
@@ -148,7 +148,6 @@
     def checkDescriptorConsistency(self, regen=1):
         """DOCDOC"""
         identity = None
-        config = None
         bad = []
         for ks,_,_ in self.keySets:
             ok = ks.checkConsistency(self.config, 0)
@@ -604,7 +603,7 @@
 
     def checkConsistency(self, config, log=1):
         """DOCDOC"""
-        return checkDecsriptorConsistency(config,log,self.published)
+        return checkDescriptorConsistency(config,log,self.published)
 
     def publish(self, url):
         """DOCDOC Returns 'accept', 'reject', 'error'. """
@@ -671,10 +670,8 @@
        Return true iff info may have come from 'config'.  If 'log' is
        true, warn as well.  Does not check keys.
     """
-
     warn = _WarnWrapper(silence = not log, isPublished=isPublished)
 
-    fixable = 1
     config_s = config['Server']
     info_s = info['Server']
     if config_s['Nickname'] and (info_s['Nickname'] != config_s['Nickname']):
@@ -686,8 +683,7 @@
     if idBits != confIDBits:
         warn("Mismatched identity bits: %s in configuration; %s published.",
              confIDBits, idBits)
-        warn.called -= 1
-        fixable = 0
+        warn.called -= 1 # We can't do anything about this!
 
     if config_s['Contact-Email'] != info_s['Contact']:
         warn("Mismatched contacts: %s in configuration; %s published.",

Index: ServerMain.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/ServerMain.py,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- ServerMain.py	28 May 2003 04:53:34 -0000	1.58
+++ ServerMain.py	28 May 2003 06:37:43 -0000	1.59
@@ -43,7 +43,6 @@
 import os
 import sys
 import signal
-import string
 import time
 import threading
 from types import *
@@ -80,12 +79,12 @@
     elif not os.path.exists(versionFile):
         dirVersion = "1000"
     else:
-        dirVersion = readFile(f).strip()
+        dirVersion = readFile(versionFile).strip()
 
     return dirVersion
 
 def checkHomedirVersion(config):
-    dirVersion = getDirVersion(config)
+    dirVersion = getHomedirVersion(config)
 
     if dirVersion is None:
         return None
@@ -608,7 +607,7 @@
         #XXXX004 Catch ConfigError for bad serverinfo.
         try:
             self.keyring = mixminion.server.ServerKeys.ServerKeyring(config)
-        except ConfigError, e:
+        except mixminion.Config.ConfigError, e:
             if str(e).startswith("Unrecognized descriptor version: 0.1"):
                 raise UIError("This server homedir contains keys in an old "
                               "format.\nConsider running 'mixminion server"
@@ -778,7 +777,7 @@
                     return
                 elif GOT_HUP:
                     LOG.info("Caught sighup")
-                    self.reset()
+                    self.doReset()
                     GOT_HUP = 0
                 # Make sure that our worker threads are still running.
                 if not (self.cleaningThread.isAlive() and
@@ -1064,7 +1063,7 @@
 
     homeDir = config['Server']['Homedir']
     keyDir = os.path.join(homeDir, 'keys')
-    hashDir = os.path.join(hashDir, 'hashlogs')
+    hashDir = os.path.join(homeDir, 'work', 'hashlogs')
     keysets = []
     if not os.path.exists(keyDir):
         print >>sys.stderr, "No server keys to upgrade."
@@ -1076,13 +1075,12 @@
                     keyDir, name, hashDir))
 
     errors = 0
-    remove = 0
     keep = 0
     for keyset in keysets:
         try:
             keyset.load()
             keep += 1
-        except ConfigError, e:
+        except mixminion.Config.ConfigError, e:
             errors += 1
             if e.startswith("Unrecognized descriptor version: 0.1"):
                 print "Removing old keyset %s"%keyset.keyname
@@ -1109,7 +1107,7 @@
     for qd in queueDirs:
         if not os.path.exists(qd): continue
         files = os.listdir(qd)
-        print "   (Deleting %s files from %s)" %(len(files,qd))
+        print "   (Deleting %s files from %s.)" %(len(files),qd)
         secureDelete([os.path.join(qd,f) for f in files])
 
     print "Homedir is upgraded"
@@ -1143,20 +1141,16 @@
 """.strip()
 
 def signalServer(cmd, args):
-    config = configFromServerArgs(cmd, args, usage=_SIGNAL_SERVER_USAGE)
+    config = configFromServerArgs(cmd, args, usage=_SIGNAL_SERVER_USAGE%cmd)
     LOG.setMinSeverity("ERROR")
 
-    checkHomedirVersion(config)
-    
     if cmd.endswith("stop-server") or cmd.endswith("server-stop"):
         reload = 0
     else:
         assert cmd.endswith("reload-server") or cmd.endswith("server-reload")
         reload = 1
 
-    if usage:
-        print _SIGNAL_SERVER_USAGE % { 'cmd' : cmd }
-        return
+    checkHomedirVersion(config)
 
     _signalServer(config, reload)
 
@@ -1171,10 +1165,7 @@
         raise UIError("No server seems to be running.")
 
     try:
-        f = open(pidFile, 'r')
-        s = f.read()
-        f.close()
-        pid = string.atoi(s)
+        pid = int(readFile(pidFile))
     except (IOError, ValueError), e:
         raise UIError("Couldn't read pid file: %s"%e)
 

Index: ServerQueue.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/ServerQueue.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- ServerQueue.py	26 May 2003 20:04:27 -0000	1.15
+++ ServerQueue.py	28 May 2003 06:37:44 -0000	1.16
@@ -438,7 +438,6 @@
     def _rescan(self, now=None):
         """Helper: Rebuild the internal state of this queue from the
            underlying directory.  Trashes 'pending' and 'sendable'."""
-        fname = os.path.join(self.dir, "metadata")
         try:
             self._lock.acquire()
             self.pending = {}