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

[minion-cvs] Fix suggested by Colin Tuckley: when we get an improper...



Update of /home/minion/cvsroot/src/minion/lib/mixminion
In directory moria:/tmp/cvs-serv20875/lib/mixminion

Modified Files:
	ServerInfo.py 
Log Message:
Fix suggested by Colin Tuckley: when we get an improperly compressed downloaded directory, propagate the IOError as a ConfigError so that we can recover sensibly.

Index: ServerInfo.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/ServerInfo.py,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -d -r1.94 -r1.95
--- ServerInfo.py	9 Aug 2005 15:51:32 -0000	1.94
+++ ServerInfo.py	16 Nov 2006 23:31:36 -0000	1.95
@@ -552,7 +552,10 @@
         if string:
             contents = string
         else:
-            contents = readPossiblyGzippedFile(fname)
+            try:
+                contents = readPossiblyGzippedFile(fname)
+            except (IOError, zlib.error), e:
+                raise ConfigError("Couldn't decompress %s: %s"%(fname,e))
 
         contents = _cleanForDigest(contents)
 
@@ -611,7 +614,10 @@
         if string:
             contents = string
         else:
-            contents = readPossiblyGzippedFile(fname)
+            try:
+                contents = readPossiblyGzippedFile(fname)
+            except (IOError, zlib.error), e:
+                raise ConfigError("Couldn't decompress %s: %s"%(fname,e))
 
         contents = _cleanForDigest(contents)
 
@@ -692,7 +698,11 @@
 
 def parseDirectory(fname, validatedDigests=None):
     """DOCDOC"""
-    s = readPossiblyGzippedFile(fname)
+    try:
+        s = readPossiblyGzippedFile(fname)
+    except (IOError, zlib.error), e:
+        raise ConfigError("Couldn't decompress %s: %s"%(fname,e))
+
     if s.startswith("[Directory]\n"):
         tp = ServerDirectory
     else: