From 08636c994b462d9cc80841ac5a87a8e2e18665f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ba=C5=A1ti?= Date: Wed, 3 Jul 2019 21:40:12 +0200 Subject: [PATCH] Flatten: improve error handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flatten provides also information about invalid manifests, so we cannot handle output of flatten as server error only. Now OMPS check exception raised from flatten to provide more accurate error. Signed-off-by: Martin Bašti --- omps/api/v1/push.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/omps/api/v1/push.py b/omps/api/v1/push.py index 2410749..b740705 100644 --- a/omps/api/v1/push.py +++ b/omps/api/v1/push.py @@ -25,7 +25,7 @@ OMPSUploadedFileError, OMPSExpectedFileError, QuayPackageNotFound, - QuayCourierError, + raise_for_courier_exception, ) from omps.greenwave import GREENWAVE from omps.koji_util import KOJI @@ -178,9 +178,7 @@ def _flatten_manifest_structure(source_dir, dest_dir): try: flatten(source_dir, dest_dir) except OpCourierError as e: - raise QuayCourierError( - 'Failed to flatten manifest directory: {}'.format(e) - ) + raise_for_courier_exception(e) if not os.listdir(dest_dir): # if dest dir is empty, it means that flatten did noop and source dir