[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 5e77def56476ae23602c01ea5323788dac918203
Author: Andreas Beckmann <anbe at debian.org>
Date:   Sun Apr 7 15:07:35 2013 +0200

    dwke: gracefully handle missing sections
    
    Signed-off-by: Andreas Beckmann <anbe at debian.org>

diff --git a/debian/changelog b/debian/changelog
index aed4b7e..dc6714c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -26,6 +26,8 @@ piuparts (0.51) UNRELEASED; urgency=low
   * piuparts-analyze.py:
   * piuparts-report.py:
   * Makefile:
+  * detect_well_known_errors:
+    - Skip sections that don't exist in piuparts.conf.
   * scripts-wheezy/post_setup_wheezy-fake-essential: New custom script to
     suppress some purge failures in wheezy.
   * New known problem: Database setup failure (issue).
diff --git a/master-bin/detect_well_known_errors b/master-bin/detect_well_known_errors
index 6e9f78b..159e341 100755
--- a/master-bin/detect_well_known_errors
+++ b/master-bin/detect_well_known_errors
@@ -19,13 +19,16 @@
 # with this program; if not, see <http://www.gnu.org/licenses/>.
 
 import ConfigParser
-import piupartslib
 import os
 import time
 import re
 from collections import namedtuple
 import argparse
 
+import piupartslib
+from piupartslib.conf import MissingSection
+
+
 CONFIG_FILE = "/etc/piuparts/piuparts.conf"
 DISTRO_CONFIG_FILE = "/etc/piuparts/distros.conf"
 KPR_DIRS = ( 'pass', 'bugged', 'affected', 'fail' )
@@ -410,6 +413,10 @@ def process_section( section, config, problem_list,
                      recheck=False, recheck_failed=False, pkgsdb=None ):
     """ Update .bug and .kpr files for logs in this section """
 
+    # raises MissingSection if the section does not exist in piuparts.conf
+    section_config = WKE_Section_Config( section )
+    section_config.read( CONFIG_FILE )
+
     sectiondir = os.path.join( config['master-directory'], section )
     workdirs = [ os.path.join(sectiondir,x) for x in KPR_DIRS ]
 
@@ -432,9 +439,6 @@ def process_section( section, config, problem_list,
         oldcwd = os.getcwd()
         os.chdir(config['master-directory'])
 
-        section_config = WKE_Section_Config( section )
-        section_config.read( CONFIG_FILE )
-
         distro_config = piupartslib.conf.DistroConfig(
                         DISTRO_CONFIG_FILE, section_config["mirror"])
 
@@ -462,6 +466,7 @@ def process_section( section, config, problem_list,
 def detect_well_known_errors( config, problem_list, recheck, recheck_failed ):
 
     for section in config['sections'].split():
+      try:
         print time.strftime( "%a %b %2d %H:%M:%S %Z %Y", time.localtime() )
         print "%s:" % section
 
@@ -475,6 +480,8 @@ def detect_well_known_errors( config, problem_list, recheck, recheck_failed ):
             pcount = len(failures.filtered(prob.name))
             if pcount:
                 print "%7d %s" % (pcount, prob.name)
+      except MissingSection:
+        pass
 
     print time.strftime( "%a %b %2d %H:%M:%S %Z %Y", time.localtime() )
 

-- 
piuparts git repository



More information about the Piuparts-commits mailing list