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

[minion-cvs] Tie pinging back into main server code; appease pycheck...



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

Modified Files:
	ClientDirectory.py ClientMain.py Filestore.py ServerInfo.py 
	ThreadUtils.py test.py 
Log Message:
Tie pinging back into main server code; appease pychecker.

Index: ClientDirectory.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/ClientDirectory.py,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- ClientDirectory.py	6 Dec 2004 20:38:01 -0000	1.45
+++ ClientDirectory.py	12 Dec 2004 22:28:39 -0000	1.46
@@ -425,7 +425,7 @@
         """Fetch a new directory."""
         if self.__downloading:
             LOG.info("Download already in progress")
-            return 0
+            return
         self.__downloading = 1
         self._downloadDirectoryImpl(url,lock)
         self.__downloading = 0

Index: ClientMain.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/ClientMain.py,v
retrieving revision 1.183
retrieving revision 1.184
diff -u -d -r1.183 -r1.184
--- ClientMain.py	7 Dec 2004 01:44:30 -0000	1.183
+++ ClientMain.py	12 Dec 2004 22:28:39 -0000	1.184
@@ -1672,7 +1672,6 @@
 
     parser.init()
     directory = parser.directory
-    config = parser.config
     clientLock()
     try:
         directory.update(force=1)

Index: Filestore.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/Filestore.py,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- Filestore.py	9 Aug 2004 20:04:59 -0000	1.23
+++ Filestore.py	12 Dec 2004 22:28:39 -0000	1.24
@@ -329,7 +329,7 @@
                 res = cPickle.load(f)
                 f.close()
                 return res
-            except cPickle.UnpicklingError, e:
+            except (cPickle.UnpicklingError, EOFError, IOError), e:
                 LOG.error("Found damaged object %s in filestore %s: %s",
                           handle, self.dir, str(e))
                 self._preserveCorrupted(handle)

Index: ServerInfo.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/ServerInfo.py,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -d -r1.87 -r1.88
--- ServerInfo.py	7 Dec 2004 01:44:30 -0000	1.87
+++ ServerInfo.py	12 Dec 2004 22:28:39 -0000	1.88
@@ -621,6 +621,7 @@
         for s in servers:
             si = ServerInfo(string=s, validatedDigests=validatedDigests,
                             _keepContents=_keepServerContents)
+            self.servers.append(si)
         self.goodServerNames = [ name.lower()
              for name in self.dirInfo['Directory-Info']['Recommended-Servers'] ]
 
@@ -643,7 +644,7 @@
                 continue
             if s.checkSignature():
                 # XXXX008 LOG.debug("Valid signature from %s")
-                self.signers.append[(digest, url)]
+                self.signers.append((digest, url))
             else:
                 #LOG.debug("Invalid signature from %s") XXXX008
                 continue
@@ -764,7 +765,7 @@
 
     def __init__(self, string):
         self.sigStatus = None
-        mixminion.Config._ConfigFile.__init__(self, string=contents)
+        mixminion.Config._ConfigFile.__init__(self, string=string)
 
     def prevalidate(self, contents):
         for name, ents in contents:
@@ -806,11 +807,11 @@
 
     def __init__(self, string):
         self.sigStatus = None
-        mixminion.Config._ConfigFile.__init__(self, string=contents)
+        mixminion.Config._ConfigFile.__init__(self, string=string)
 
-    def validate(self):
-        sec = self['Signed-Directory']
-        idKeyBytes = sec['Directory-Identity'].get_modulus_bytes() 
+    def validate(self, lines, contents):
+        sec = contents['Signed-Directory']
+        idKeyBytes = sec['Directory-Identity'].get_modulus_bytes()
         if not (2048 <= idKeyBytes*8 <= 4096):
             raise ConfigError("Identity key length is out of range (%s bits)"
                               % idKeyBytes*8)

Index: ThreadUtils.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/ThreadUtils.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- ThreadUtils.py	12 Dec 2004 02:48:16 -0000	1.5
+++ ThreadUtils.py	12 Dec 2004 22:28:39 -0000	1.6
@@ -10,8 +10,10 @@
 __all__ = [ 'MessageQueue', 'QueueEmpty', 'ClearableQueue', 'TimeoutQueue',
             'RWLock', 'ProcessingThread', 'BackgroundingDecorator' ]
 
+import sys
 import threading
 import time
+from mixminion.Common import LOG
 
 import thread
 _get_ident = thread.get_ident
@@ -265,9 +267,9 @@
         def __call__(self):
             raise self
 
-    def __init__(self):
+    def __init__(self, name="processing thread"):
         """Create a new processing thread."""
-        threading.Thread.__init__(self, name="processing thread")
+        threading.Thread.__init__(self)
         self.mqueue = ClearableQueue()
         self.threadName = name
 

Index: test.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/test.py,v
retrieving revision 1.210
retrieving revision 1.211
diff -u -d -r1.210 -r1.211
--- test.py	12 Dec 2004 02:48:16 -0000	1.210
+++ test.py	12 Dec 2004 22:28:39 -0000	1.211
@@ -3272,7 +3272,7 @@
 
         d = WD(loc, "testing")
         try:
-            d["xyzzy"]
+            _ = d["xyzzy"]
         except KeyError:
             pass
         else:
@@ -7122,16 +7122,18 @@
         pathIs((p1[:1],p2[-2:]), ((alice,),(bob,lola)))
 
         # 1a'. Filename with internal commas and colons, where permitted.
-        fredfile2 = os.path.join(mix_mktemp(), "a:b,c")
+        dirname3 = mix_mktemp()
+        os.mkdir(dirname3, 0700)
+        fredfile2 = os.path.join(dirname3, "a:b,c")
         try:
             writeFile(fredfile2,edesc["Fred"][1])
-        except OSError:
+        except OSError, e:
             pass
         else:
             p1,p2 = ppath(ks, None, "Alice,%r,Bob,Joe"%fredfile2, email)
-            pathIs(p1,p2), ((alice,fred),(bob,joe))
+            pathIs((p1,p2), ((alice,fred),(bob,joe)))
             p1,p2 = ppath(ks, None, "%r,Alice,Bob,Joe"%fredfile2, email)
-            pathIs(p1,p2), ((fred,alice),(bob,joe))
+            pathIs((p1,p2), ((fred,alice),(bob,joe)))
 
         # 1b. Colon, no star
         p1,p2 = ppath(ks, None, "Alice:Fred,Joe", email)
@@ -7215,7 +7217,6 @@
         ks = mixminion.ClientDirectory.ClientDirectory(config)
         ks.clean(now=now+oneDay*500) # Should zap all of imported servers.
         raises(MixError, ks.getServerInfo, "Lola", strict=1)
-        ks.getServerInfo
 
     def testFeatureMaps(self):
         from mixminion.ClientDirectory import compressFeatureMap
@@ -7443,7 +7444,6 @@
 
         # Now try with some servers...
         edesc = getExampleServerDescriptors()
-        ServerInfo = mixminion.ServerInfo.ServerInfo
 
         # ... and for now, we need to restart the client.
         client = mixminion.ClientMain.MixminionClient(usercfg)