From d5dd6a85d91dc4e541301e882ff45fd5eb9cdc5f Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Mon, 16 Feb 2015 17:33:08 +0200 Subject: [PATCH] New exit code (4) indicating gbp crashes The service now returns 4 when gbp crashes on an unhandled exception. Change-Id: Ic202f8bd921eea5a3b76a593fd973658d36df9bb Signed-off-by: Markus Lehtonen --- obs_service_gbp/command.py | 3 ++- tests/test_obs_service_gbp.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/obs_service_gbp/command.py b/obs_service_gbp/command.py index 0ab2754..a11a869 100644 --- a/obs_service_gbp/command.py +++ b/obs_service_gbp/command.py @@ -43,6 +43,7 @@ EXIT_OK = 0 EXIT_ERR_SERVICE = 1 EXIT_ERR_RPM_EXPORT = 2 EXIT_ERR_DEB_EXPORT = 3 +EXIT_ERR_GBP_CRASH = 4 class ExportError(Exception): @@ -173,7 +174,7 @@ def gbp_export(repo, args, config): LOGGER.error('Unhandled exception in GBP:\n' '%s', err.prettyprint_tb()) raise ExportError('Failed to export packaging files', - EXIT_ERR_SERVICE) + EXIT_ERR_GBP_CRASH) except GbpServiceError as err: LOGGER.error('Internal service error when trying to run GBP: %s', err) raise ExportError('This is most likely a configuration error (or a ' diff --git a/tests/test_obs_service_gbp.py b/tests/test_obs_service_gbp.py index 17ba0cc..29f4844 100644 --- a/tests/test_obs_service_gbp.py +++ b/tests/test_obs_service_gbp.py @@ -107,12 +107,12 @@ class TestService(UnitTestsBase): @mock.patch('obs_service_gbp.command.gbp_deb', _mock_gbp) def test_deb_crash(self): """Test crash in git-buildpackage""" - eq_(service(['--url', self.orig_repo.path, '--revision=deb']), 1) + eq_(service(['--url', self.orig_repo.path, '--revision=deb']), 4) @mock.patch('obs_service_gbp.command.gbp_rpm', _mock_gbp) def test_rpm_crash(self): """Test crash in git-buildpackage-rpm""" - eq_(service(['--url', self.orig_repo.path, '--revision=rpm']), 1) + eq_(service(['--url', self.orig_repo.path, '--revision=rpm']), 4) @mock.patch('obs_service_gbp.command.fork_call', _mock_fork_call) def test_service_error(self): -- 2.34.1