From 0263a8200bea7bb21ecab1aee6c99a606f652982 Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Apr 10 2022 21:13:45 +0000 Subject: rpmbuild: don't fail a build because of fedora-review Fix #2040 We raise an exception in the `run_cmd` function if the program exit code is not zero. Therefore the error handling within the `FedoraReview` class didn't work. We need to catch the exception. --- diff --git a/rpmbuild/copr_rpmbuild/automation/fedora_review.py b/rpmbuild/copr_rpmbuild/automation/fedora_review.py index 8bff780..d40ebd5 100644 --- a/rpmbuild/copr_rpmbuild/automation/fedora_review.py +++ b/rpmbuild/copr_rpmbuild/automation/fedora_review.py @@ -41,11 +41,14 @@ class FedoraReview(AutomationTool): "--mock-config", self.mock_config_file, ] - result = run_cmd(cmd, cwd=self.resultdir) - self.log.info(result.stdout) - if result.returncode: - self.log.warning("Fedora review failed\nerr:\n%s", result.stderr) - self._filter_results_directory() + try: + result = run_cmd(cmd, cwd=self.resultdir) + self.log.info(result.stdout) + self._filter_results_directory() + except RuntimeError as ex: + self.log.warning("Fedora review failed\nerr:\n%s", ex) + self.log.warning("The build itself will not be marked " + "as failed because of this") def _filter_results_directory(self): """