From fd33d68bd7991be61038d2df340720c7ef09b14f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tibor=20Dudl=C3=A1k?= Date: Tue, 21 Feb 2023 13:51:39 +0100 Subject: [PATCH] fix(Beaker): rerurn common dictionary when validation fails MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit when Beaker distro/image is not recognized by beakerhub mrack failed with exception as newer code expects dictionary error object. Signed-off-by: Tibor Dudlák --- src/mrack/providers/beaker.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mrack/providers/beaker.py b/src/mrack/providers/beaker.py index dc1dc3be..a33297d3 100644 --- a/src/mrack/providers/beaker.py +++ b/src/mrack/providers/beaker.py @@ -47,7 +47,7 @@ def parse_bkr_exc_str(exc_str): - """Parse exception string and return more readable string for mrack error.""" + """Parse exception string and return response dictionary for mrack error.""" # we expect exception string to look like following: # ':No distro tree matches Recipe: # @@ -60,7 +60,7 @@ def parse_bkr_exc_str(exc_str): and "bkr.common.bexceptions" not in exc_str.faultString ): # we got string we do not expect so just use the traceback - return str(exc_str) + return {"response": str(exc_str)} # because of expected format we split by ":" and use last 2 values from list # in above example it would be @@ -69,7 +69,7 @@ def parse_bkr_exc_str(exc_str): # '\t ... # ] fault = [f"\t{f.strip()}" for f in exc_str.faultString.split(":")[-2:]] - return "\n".join(fault) + return {"response": "\n".join(fault)} class BeakerProvider(Provider):