From e51ccbe7c3c6e0836774e5d062fa58b3630ec179 Mon Sep 17 00:00:00 2001 From: dparalen Date: Tue, 20 Oct 2015 14:59:16 +0200 Subject: avoid duplicate text in ISCSIError message The ISCSIError class defines a class-level message attribute with value: "Error starting iSCSI target". This attribute is further processed in RESTError.__init__ method, the ISCSIError super-class, to create an Exception message concatenating self.message with provided details argument. However, the ISCISError.__init__ method provides a details attribute prefixed with the same text to the super(ISCSIError, self).__init__ method. As a result, the text appears twice: "ISCSIError: Error starting iSCSI target: Error starting iSCSI target: ISCSI daemon didn't initialize. Failed with exit code 107. stdout: . stderr: tgtadm: failed to send request hdr to tgt daemon, Transport endpoint is not connected" The patch purpose is to remove the details prefix to avoid duplicate text in the exception text while honouring ISCSIError.message. Change-Id: I9e1434ae17da5112527a841ac069ed2285566cca --- ironic_python_agent/errors.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'ironic_python_agent/errors.py') diff --git a/ironic_python_agent/errors.py b/ironic_python_agent/errors.py index 92c3825f..6b98fbd0 100644 --- a/ironic_python_agent/errors.py +++ b/ironic_python_agent/errors.py @@ -311,8 +311,7 @@ class ISCSIError(RESTError): message = 'Error starting iSCSI target' def __init__(self, error_msg, exit_code, stdout, stderr): - details = ('Error starting iSCSI target: {0}. Failed with exit code ' - '{1}. stdout: {2}. stderr: {3}') + details = ('{0}. Failed with exit code {1}. stdout: {2}. stderr: {3}') details = details.format(error_msg, exit_code, stdout, stderr) super(ISCSIError, self).__init__(details) -- cgit v1.2.1