From 5a032f4aba1e317dd228c88edf5c26837eaeb09e Mon Sep 17 00:00:00 2001 From: Luis Eduardo Bonatti Date: Wed, 1 Mar 2023 09:34:35 -0300 Subject: [PATCH] Enhance subcloud upgrade orchestration failure message If a subcloud fails to be upgraded due to missing rvmc image, the error message is unclear. This commit improves the error message. Test Plan: PASS: Unit test on exception PASS: Manually raised exception with mock values locally Task: 47562 Story: 2009303 Signed-off-by: Luis Eduardo Bonatti Change-Id: I3082145c2ec4b715c35e7cf0477c0287b2151de6 --- distributedcloud/dccommon/exceptions.py | 6 ++++++ distributedcloud/dccommon/subcloud_install.py | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/distributedcloud/dccommon/exceptions.py b/distributedcloud/dccommon/exceptions.py index 66014f442..5ed8d7bf9 100644 --- a/distributedcloud/dccommon/exceptions.py +++ b/distributedcloud/dccommon/exceptions.py @@ -113,3 +113,9 @@ class PlaybookExecutionFailed(DCCommonException): class PlaybookExecutionTimeout(PlaybookExecutionFailed): message = _("Playbook execution failed [TIMEOUT (%(timeout)s)], " "command=%(playbook_cmd)s") + + +class ImageNotInLocalRegistry(NotFound): + message = _("Image %(image_name)s:%(image_tag)s not found in the local registry. " + "Please check with command: system registry-image-list or " + "system registry-image-tags %(image_name)s") diff --git a/distributedcloud/dccommon/subcloud_install.py b/distributedcloud/dccommon/subcloud_install.py index 101d47d4e..b49a230ce 100644 --- a/distributedcloud/dccommon/subcloud_install.py +++ b/distributedcloud/dccommon/subcloud_install.py @@ -195,7 +195,8 @@ class SubcloudInstall(object): msg = "Error: Image %s:%s not found in the local registry." % ( image_name, image_tag) LOG.error(msg) - raise exceptions.NotFound() + raise exceptions.ImageNotInLocalRegistry(image_name=image_name, + image_tag=image_tag) @staticmethod def create_rvmc_config_file(override_path, payload):