summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Bartosh <eduard.bartosh@intel.com>2014-03-17 17:05:38 +0200
committerEduard Bartosh <eduard.bartosh@intel.com>2014-03-18 15:23:09 +0200
commit917064a1e6ffa66a6c203516509657d711bf2a02 (patch)
treeff3ea5aaa50af7e270a655240637555b122dee78
parent7df5c005d07e1f9e5762c95442570fe8a3866587 (diff)
downloadrepa-917064a1e6ffa66a6c203516509657d711bf2a02.tar.gz
repa-917064a1e6ffa66a6c203516509657d711bf2a02.tar.bz2
repa-917064a1e6ffa66a6c203516509657d711bf2a02.zip
Fixed crash when rejecting broken package
To obtain revision create_sr code queries source package and crashes when source is broken with ObsError: <obs>cat't query source <package> from project <prerelease project>: HTTP Error 400: service gbs failed This makes it impossible to reject broken submissions. This change catches exeption and tries to avoid querying the source by providing revision 1 to create_sr API. As for rejecting it doesn't matter much which revision to reject it should be safe. Fixes: #1687 Change-Id: I21b9dda32686c94bfb8e81201424b3e7e7f128b5 Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com> Reviewed-on: https://otctools.jf.intel.com/review/10674 Tested-by: OTC Tools Tester <ed.bartosh@linux.intel.com>
-rw-r--r--repa/common.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/repa/common.py b/repa/common.py
index b161077..02ec146 100644
--- a/repa/common.py
+++ b/repa/common.py
@@ -91,8 +91,20 @@ def accept_or_reject(obs, submission, state, target, comment=''):
for pkg in obs.get_source_packages(project):
# Create SR
- reqid = obs.create_sr(project, pkg, str(meta['obs_target_prj']),
- message=str(message))
+ try:
+ reqid = obs.create_sr(project, pkg, str(meta['obs_target_prj']),
+ message=str(message))
+ except RepaException:
+ if state == 'declined':
+ # Broken sources. Try to avoid queryng source by
+ # providing revision 1. It always exists and it doesn't
+ # matter which revision to reject.
+ reqid = obs.create_sr(project, pkg,
+ str(meta['obs_target_prj']),
+ message=str(message), revision=1)
+ else:
+ raise
+
print 'package %s: created SR %s' % (pkg, reqid)
# and immediately set its state