From: Ed Bartosh Date: Mon, 17 Mar 2014 13:33:17 +0000 (+0200) Subject: Catch osc exceptions in obs.py:get_projects X-Git-Tag: 0.2~41 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0ae4d26d4f1e836188bf05ac607e5120c854f655;p=tools%2Frepa.git Catch osc exceptions in obs.py:get_projects Catch OSCError exceptions and raises RepaException with the meaningful error message. RepaException is processed in main.py and prints error message to stderr. Fixes: #1708 Change-Id: I966013766e2756d64edf02c9cc6ac51d42f3a525 Signed-off-by: Ed Bartosh Reviewed-on: https://otctools.jf.intel.com/review/10671 Tested-by: OTC Tools Tester --- diff --git a/repa/obs.py b/repa/obs.py index 6d4e858..a4f7413 100644 --- a/repa/obs.py +++ b/repa/obs.py @@ -45,6 +45,8 @@ from osc import core from gitbuildsys.oscapi import OSC, ObsError, OSCError from gitbuildsys.utils import Temp +from repa.common import RepaException + OSCRC_TEMPLATE = """[general] apiurl = %(apiurl)s @@ -77,11 +79,20 @@ class OBS(OSC): def get_projects(self, regexp=''): """List projects with attributes.""" - for project in core.meta_get_project_list(self.apiurl): + try: + projects = core.meta_get_project_list(self.apiurl) + except OSCError as err: + raise RepaException("cat't get list of projects from %s: %s" % + (self.apiurl, err)) + + for project in projects: if regexp and not re.match(regexp, project): continue - yield project, self.get_description(project) - + try: + yield project, self.get_description(project) + except OSCError as err: + raise RepaException("Can't get a description from %s: %s" % + (project, err)) def get_build_results(self, prj): """Get project build results."""