From 817ec823a273ad40004ef9bf0fcbd9c421ce8261 Mon Sep 17 00:00:00 2001 From: Mike Raineri Date: Fri, 12 Aug 2022 11:12:29 -0400 Subject: [PATCH] Corrected flow when handling system reset exceptions to ensure it stays raised Signed-off-by: Mike Raineri --- redfish_utilities/systems.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/redfish_utilities/systems.py b/redfish_utilities/systems.py index fe32cf6..e910d4a 100644 --- a/redfish_utilities/systems.py +++ b/redfish_utilities/systems.py @@ -312,13 +312,14 @@ def system_reset( context, system_id = None, reset_type = None ): try: verify_response( response ) except Exception as e: + additional_message = "" if response.status == 400: # Append the list of valid reset types to 400 Bad Request responses - supported_reset_types = "No supported reset types listed" + additional_message = "\nNo supported reset types listed" for param in reset_parameters: if param["Name"] == "ResetType" and "AllowableValues" in param: - supported_reset_types = "Supported reset types: {}".format( ", ".join( param["AllowableValues"] ) ) - raise type( e )( str( e ) + "\n" + supported_reset_types ).with_traceback( sys.exc_info()[2] ) + additional_message = "\nSupported reset types: {}".format( ", ".join( param["AllowableValues"] ) ) + raise type( e )( str( e ) + additional_message ).with_traceback( sys.exc_info()[2] ) return response def get_virtual_media( context, system_id = None ):