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:
Dr. Jens Harbott
2025-01-30 10:50:24 +01:00
parent 953dec09ef
commit 91b656d31c
2 changed files with 11 additions and 1 deletions

View File

@@ -212,9 +212,13 @@ class SessionCache(object):
# include it in the session key.
# NOTE(TheJulia): Multiplying the address by 4, to ensure
# 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(
'sha512',
driver_info.get('password').encode('utf-8'),
password.encode('utf-8'),
str(driver_info.get('address') * 4).encode('utf-8'), 40)
self._driver_info = driver_info
# Assemble the session key and append the hashed password to it,

View File

@@ -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>`_.