Add error information to error messages
This patch adds error information to an error message when an SCCI request hit an error for giving more information. The error information can be got from an SCCI response as an Error element. Change-Id: I07fc86909e278ed70f6951505105b382d2b29e76
This commit is contained in:
@@ -284,11 +284,13 @@ def scci_cmd(host, userid, password, cmd, port=443, auth_method='basic',
|
||||
result_xml = ET.fromstring(r.text)
|
||||
status = result_xml.find("./Value")
|
||||
# severity = result_xml.find("./Severity")
|
||||
error = result_xml.find("./Error")
|
||||
message = result_xml.find("./Message")
|
||||
if not int(status.text) == 0:
|
||||
raise SCCIClientError(
|
||||
('SCCI PROTOCOL ERROR, STATUS CODE = %s, '
|
||||
'MESSAGE = %s' % (str(status.text), message.text)))
|
||||
'ERROR = %s, MESSAGE = %s' %
|
||||
(str(status.text), error.text, message.text)))
|
||||
else:
|
||||
return r
|
||||
|
||||
|
||||
@@ -380,7 +380,8 @@ class SCCITestCase(testtools.TestCase):
|
||||
client,
|
||||
scci.POWER_SOFT_OFF)
|
||||
self.assertEqual(
|
||||
'SCCI PROTOCOL ERROR, STATUS CODE = 31, MESSAGE = Error 31'
|
||||
'SCCI PROTOCOL ERROR, STATUS CODE = 31,'
|
||||
' ERROR = ServerView Agent not connected, MESSAGE = Error 31'
|
||||
' (Import of settings in WinSCU XML format failed) occurred',
|
||||
str(e))
|
||||
|
||||
@@ -425,7 +426,8 @@ class SCCITestCase(testtools.TestCase):
|
||||
client,
|
||||
scci.POWER_SOFT_CYCLE)
|
||||
self.assertEqual(
|
||||
'SCCI PROTOCOL ERROR, STATUS CODE = 31, MESSAGE = Error 31'
|
||||
'SCCI PROTOCOL ERROR, STATUS CODE = 31,'
|
||||
' ERROR = ServerView Agent not connected, MESSAGE = Error 31'
|
||||
' (Import of settings in WinSCU XML format failed) occurred',
|
||||
str(e))
|
||||
|
||||
@@ -470,7 +472,8 @@ class SCCITestCase(testtools.TestCase):
|
||||
client,
|
||||
scci.POWER_CANCEL_SHUTDOWN)
|
||||
self.assertEqual(
|
||||
'SCCI PROTOCOL ERROR, STATUS CODE = 31, MESSAGE = Error 31'
|
||||
'SCCI PROTOCOL ERROR, STATUS CODE = 31,'
|
||||
' ERROR = ServerView Agent not connected, MESSAGE = Error 31'
|
||||
' (Import of settings in WinSCU XML format failed) occurred',
|
||||
str(e))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user