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

[minion-cvs] Give a more informative error on an empty directory.



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

Modified Files:
	Config.py test.py 
Log Message:
Give a more informative error on an empty directory.

Index: Config.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/Config.py,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -d -r1.82 -r1.83
--- Config.py	23 Mar 2004 00:13:55 -0000	1.82
+++ Config.py	23 Mar 2004 00:24:31 -0000	1.83
@@ -539,6 +539,9 @@
     if fileLines[-1] == '':
         del fileLines[-1]
 
+    if len(fileLines) == 1 and fileLines[0].strip() == '':
+        raise ConfigError("File is empty")
+
     for line in fileLines:
         lineno += 1
         line = line.strip()

Index: test.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/test.py,v
retrieving revision 1.191
retrieving revision 1.192
diff -u -d -r1.191 -r1.192
--- test.py	6 Mar 2004 05:33:55 -0000	1.191
+++ test.py	23 Mar 2004 00:24:31 -0000	1.192
@@ -4188,6 +4188,8 @@
         failsR("[Sec1]\n\nFoo: Bar\n")
         failsR("\n[Sec1]\nFoo: Bar\n")
         failsR("\n[Sec1]\nFoo: Bar\n\n")
+        failsR("")
+        failsR("\n")
 
     def testValidationFns(self):
         import mixminion.Config as C