Fix for HPE MSA 2050 login failures

When authenticating to the array, use the 'response-type-numeric'
value to determine success, rather than doing a string match against the
'response-type' string, which is not guaranteed to be consistent.

Change-Id: I47fe1ff2dd5e24fffd5118aeab9473774eb58a61
Closes-Bug: #1808968
This commit is contained in:
Chris M
2019-01-18 02:13:21 +00:00
parent c068ce071b
commit 0565732a16
@@ -56,10 +56,12 @@ class DotHillClient(object):
self._session_key = None
try:
tree = etree.XML(xml)
if (tree.findtext(".//PROPERTY[@name='response-type']") ==
"success"):
self._session_key = (
tree.findtext(".//PROPERTY[@name='response']"))
# The 'return-code' property is not valid in this context, so we
# we check value of 'response-type-numeric' (0 => Success)
rtn = tree.findtext(".//PROPERTY[@name='response-type-numeric']")
session_key = tree.findtext(".//PROPERTY[@name='response']")
if rtn == '0':
self._session_key = session_key
except Exception as e:
msg = _("Cannot parse session key: %s") % e.msg
raise exception.DotHillConnectionError(message=msg)