From a45e26cfb771a61d67cc28593ee16fe159adc07f Mon Sep 17 00:00:00 2001 From: Hugo Brito Date: Fri, 7 Jul 2023 16:08:24 -0300 Subject: [PATCH] Enhance strategy error messages in dcmanager-api This commit removes the generic error message from dcmanager-client to dcmanager-api handle a more detailed message when exceptions occur. The commands that are affected by this change are: dcmanager -strategy create/apply/abort/delete. Test Plan: Test Plan: 1. Test the `dcmanager -strategy create/delete/abort/apply` commands for the following strategies: - fw-update-strategy, kube-rootca-update-strategy, kube-upgrade-strategy, patch-strategy, prestage-strategy, and upgrade-strategy. 2. Validate that the exception message does not include the old generic reason: "Unable to sw update strategy" Partial-Bug: 2026604 Change-Id: I60e1188dcbedba7ffb8e8d9e76bb563417b1b69a Signed-off-by: Hugo Brito --- .../commands/v1/sw_update_manager.py | 21 +++---------------- 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/distributedcloud-client/dcmanagerclient/commands/v1/sw_update_manager.py b/distributedcloud-client/dcmanagerclient/commands/v1/sw_update_manager.py index ce99913..0b1029c 100644 --- a/distributedcloud-client/dcmanagerclient/commands/v1/sw_update_manager.py +++ b/distributedcloud-client/dcmanagerclient/commands/v1/sw_update_manager.py @@ -246,12 +246,7 @@ class DeleteSwUpdateStrategy(base.DCManagerShowOne): return detail_format def _get_resources(self, parsed_args): - try: - return self.get_sw_update_manager().delete_sw_update_strategy() - except Exception as e: - print(e) - error_msg = "Unable to delete sw update strategy" - raise exceptions.DCManagerClientException(error_msg) + return self.get_sw_update_manager().delete_sw_update_strategy() class ApplySwUpdateStrategy(base.DCManagerShowOne): @@ -265,12 +260,7 @@ class ApplySwUpdateStrategy(base.DCManagerShowOne): return detail_format def _get_resources(self, parsed_args): - try: - return self.get_sw_update_manager().apply_sw_update_strategy() - except Exception as e: - print(e) - error_msg = "Unable to apply sw update strategy" - raise exceptions.DCManagerClientException(error_msg) + return self.get_sw_update_manager().apply_sw_update_strategy() class AbortSwUpdateStrategy(base.DCManagerShowOne): @@ -284,12 +274,7 @@ class AbortSwUpdateStrategy(base.DCManagerShowOne): return detail_format def _get_resources(self, parsed_args): - try: - return self.get_sw_update_manager().abort_sw_update_strategy() - except Exception as e: - print(e) - error_msg = "Unable to abort sw update strategy" - raise exceptions.DCManagerClientException(error_msg) + return self.get_sw_update_manager().abort_sw_update_strategy() class ListSwUpdateStrategyStep(base.DCManagerLister):