Fix redfish session cache on missing password
The redfish_password option is optional, make sure that the SessionCache does not throw an error when it is not set. Closes-Bug: 2097019 Change-Id: Idf792c982a883a4c07ae1dad72e3c54bc73b96a1
This commit is contained in:
@@ -212,9 +212,13 @@ class SessionCache(object):
|
|||||||
# include it in the session key.
|
# include it in the session key.
|
||||||
# NOTE(TheJulia): Multiplying the address by 4, to ensure
|
# NOTE(TheJulia): Multiplying the address by 4, to ensure
|
||||||
# we meet a minimum of 16 bytes for salt.
|
# we meet a minimum of 16 bytes for salt.
|
||||||
|
# NOTE(frickler): password may be None, make sure we have a str
|
||||||
|
password = driver_info.get('password')
|
||||||
|
if not password:
|
||||||
|
password = ''
|
||||||
pw_hash = hashlib.pbkdf2_hmac(
|
pw_hash = hashlib.pbkdf2_hmac(
|
||||||
'sha512',
|
'sha512',
|
||||||
driver_info.get('password').encode('utf-8'),
|
password.encode('utf-8'),
|
||||||
str(driver_info.get('address') * 4).encode('utf-8'), 40)
|
str(driver_info.get('address') * 4).encode('utf-8'), 40)
|
||||||
self._driver_info = driver_info
|
self._driver_info = driver_info
|
||||||
# Assemble the session key and append the hashed password to it,
|
# Assemble the session key and append the hashed password to it,
|
||||||
|
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Fixes an error within the redfish session cache when no
|
||||||
|
``redfish_password`` is specified
|
||||||
|
`bug 2097019 <https://bugs.launchpad.net/ironic/+bug/2097019>`_.
|
Reference in New Issue
Block a user