[Piuparts-commits] [SCM] piuparts git repository branch, master, updated. 0.51

Andreas Beckmann anbe at debian.org
Wed May 15 10:09:44 UTC 2013


The following commit has been merged in the master branch:
commit b1593c518444287690f22ef4a34e67d3f726533b
Author: Andreas Beckmann <anbe at debian.org>
Date:   Sun Apr 7 14:56:12 2013 +0200

    p-s: gracefully handle missing/disappearing sections
    
    do not abort the slave, just skip the section
    
    Signed-off-by: Andreas Beckmann <anbe at debian.org>

diff --git a/debian/changelog b/debian/changelog
index 5c373bc..aed4b7e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -22,6 +22,7 @@ piuparts (0.51) UNRELEASED; urgency=low
   * piuparts-slave.py:
     - Fix parsing 'idle' return value from master.
     - Let the piuparts-master (wrapper script) handle chdir and error logging.
+    - Skip sections that don't exist in piuparts.conf and continue to run.
   * piuparts-analyze.py:
   * piuparts-report.py:
   * Makefile:
diff --git a/piuparts-slave.py b/piuparts-slave.py
index 6f91547..753616c 100644
--- a/piuparts-slave.py
+++ b/piuparts-slave.py
@@ -38,6 +38,7 @@ import ConfigParser
 
 import piupartslib.conf
 import piupartslib.packagesdb
+from piupartslib.conf import MissingSection
 
 
 CONFIG_FILE = "/etc/piuparts/piuparts.conf"
@@ -430,8 +431,14 @@ class Section:
             action = "Flushing"
         logging.info("%s section %s (precedence=%d)" \
                      % (action, self._config.section, self.precedence()))
+
         self._config = Config(section=self._config.section, defaults_section="global")
-        self._config.read(CONFIG_FILE)
+        try:
+            self._config.read(CONFIG_FILE)
+        except MissingSection:
+            logging.info("unknown")
+            self._error_wait_until = time.time() + 3600
+            return 0
         self._distro_config = piupartslib.conf.DistroConfig(
                 DISTRO_CONFIG_FILE, self._config["mirror"])
 
@@ -836,8 +843,13 @@ def main():
     else:
         section_names = global_config["sections"].split()
 
-    sections = [Section(section_name)
-                for section_name in section_names]
+    sections = []
+    for section_name in section_names:
+        try:
+            sections.append(Section(section_name))
+        except MissingSection:
+            # ignore unknown sections
+            pass
 
     while True:
         global got_sighup

-- 
piuparts git repository



More information about the Piuparts-commits mailing list