diff --git a/src/composer/cli/utilities.py b/src/composer/cli/utilities.py index 97f348e0..199ed095 100644 --- a/src/composer/cli/utilities.py +++ b/src/composer/cli/utilities.py @@ -59,7 +59,7 @@ def handle_api_result(result, show_json=False): :param result: JSON result from the http query :type result: dict :rtype: tuple - :returns: (rc, errors) + :returns: (rc, should_exit_now) Return the correct rc for the program (0 or 1), and whether or not to continue processing the results. @@ -68,7 +68,7 @@ def handle_api_result(result, show_json=False): print(json.dumps(result, indent=4)) else: for err in result.get("errors", []): - log.error(err) + log.error(err["msg"]) # What's the rc? If status is present, use that # If not, use length of errors diff --git a/src/composer/http_client.py b/src/composer/http_client.py index 66970d39..ebbac2af 100644 --- a/src/composer/http_client.py +++ b/src/composer/http_client.py @@ -50,7 +50,8 @@ def get_url_raw(socket_path, url): if r.status == 400: err = json.loads(r.data.decode("utf-8")) if "status" in err and err["status"] == False: - raise RuntimeError(", ".join(err["errors"])) + msgs = [e["msg"] for e in err["errors"]] + raise RuntimeError(", ".join(msgs)) return r.data.decode('utf-8') @@ -172,7 +173,8 @@ def download_file(socket_path, url, progress=True): if r.status == 400: err = json.loads(r.data.decode("utf-8")) if not err["status"]: - raise RuntimeError(", ".join(err["errors"])) + msgs = [e["msg"] for e in err["errors"]] + raise RuntimeError(", ".join(msgs)) filename = get_filename(r.headers) if os.path.exists(filename):