[Piuparts-commits] rev 254 - trunk

Holger Levsen holger at alioth.debian.org
Mon Mar 16 03:52:42 UTC 2009


Author: holger
Date: 2009-03-16 03:52:42 +0000 (Mon, 16 Mar 2009)
New Revision: 254

Modified:
   trunk/piuparts-slave.py
Log:
fix some logic errors

Modified: trunk/piuparts-slave.py
===================================================================
--- trunk/piuparts-slave.py	2009-03-16 03:04:16 UTC (rev 253)
+++ trunk/piuparts-slave.py	2009-03-16 03:52:42 UTC (rev 254)
@@ -56,7 +56,7 @@
 
 class Config(piupartslib.conf.Config):
 
-    def __init__(self, section="slave"):
+    def __init__(self, section):
         self.section = section
         piupartslib.conf.Config.__init__(self, section,
             {
@@ -218,11 +218,16 @@
         self._config = Config(section=section)
         self._config.read(CONFIG_FILE)
         self._slave_directory = os.path.abspath(self._config["slave-directory"])
+        if not os.path.exists(self._slave_directory):
+            os.mkdir(self._slave_directory)
 
     def setup(self):
         if self._config["debug"] in ["yes", "true"]:
             self._logger = logging.getLogger()
             self._logger.setLevel(logging.DEBUG)
+
+        oldcwd = os.getcwd()
+        os.chdir(self._slave_directory)
         
         if not os.path.exists(self._config["chroot-tgz"]):
             create_chroot(self._config, self._config["chroot-tgz"], self._config["distro"])
@@ -247,13 +252,14 @@
             dir = os.path.join(self._slave_directory, dir)
             if not os.path.exists(dir):
                 os.makedirs(dir)
+        os.chdir(oldcwd)
 
     def run(self):
         logging.info("-------------------------------------------")
         logging.info("Running section " + self._config.section)
         self._slave.connect_to_master()
 
-        oldcwd = os.path.getcwd()
+        oldcwd = os.getcwd()
         os.chdir(self._slave_directory)
 
         for logdir in ["pass", "fail", "untestable"]:




More information about the Piuparts-commits mailing list