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

[minion-cvs] More complete handling of tildes in paths; unit tests f...



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

Modified Files:
	Modules.py ServerConfig.py ServerMain.py 
Log Message:
More complete handling of tildes in paths; unit tests for _parseFilename

Index: Modules.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/Modules.py,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- Modules.py	5 Jun 2003 05:24:23 -0000	1.40
+++ Modules.py	5 Jun 2003 05:48:39 -0000	1.41
@@ -323,7 +323,7 @@
     def setPath(self, path):
         """Sets the search path for Python modules"""
         if path:
-            self.path = path.split(":")
+            self.path = [ os.path.expanduser(fn) for fn in path.split(":") ]
         else:
             self.path = []
 

Index: ServerConfig.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/ServerConfig.py,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- ServerConfig.py	5 Jun 2003 02:18:11 -0000	1.31
+++ ServerConfig.py	5 Jun 2003 05:48:39 -0000	1.32
@@ -231,7 +231,8 @@
 SERVER_SYNTAX =  {
         'Host' : C.ClientConfig._syntax['Host'],
         'Server' : { '__SECTION__' : ('REQUIRE', None, None),
-                     'Homedir' : ('ALLOW', None, "/var/spool/minion"),
+                     'Homedir' :
+                         ('ALLOW', C._parseFilename, "/var/spool/minion"),
                      'LogFile' : ('ALLOW', None, None),
                      'LogLevel' : ('ALLOW', C._parseSeverity, "WARN"),
                      'EchoMessages' : ('ALLOW', C._parseBoolean, "no"),

Index: ServerMain.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/ServerMain.py,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -d -r1.71 -r1.72
--- ServerMain.py	5 Jun 2003 05:34:56 -0000	1.71
+++ ServerMain.py	5 Jun 2003 05:48:39 -0000	1.72
@@ -977,13 +977,13 @@
 def readConfigFile(configFile):
     #XXXX
     if configFile is None:
-        if os.path.exists(os.path.expanduser("~/.mixminiond.conf")):
-            configFile = os.path.expanduser("~/.mixminiond.conf")
-        elif os.path.exists(os.path.expanduser("~/etc/mixminiond.conf")):
-            configFile = os.path.expanduser("~/etc/mixminiond.conf")
-        elif os.path.exists("/etc/mixminiond.conf"):
-            configFile = "/etc/mixminiond.conf"
-        else:
+        configFile = None
+        for p in ["~/.mixminiond.conf", "~/etc/mixminiond.conf",
+                  "/etc/mixminiond.conf"]:
+            p = os.path.expanduser(p)
+            if os.path.exists(p):
+                configFile = p
+        if not p:
             print >>sys.stderr, "No config file found or specified."
             sys.exit(1)