Account for secret.created possibly being None

current code will simply fail with
NameError: name 'created' is not defined

Change-Id: Idb907edf84900c517f538d2bfc9f334244368067
This commit is contained in:
Pavlo Shchelokovskyy 2024-09-04 13:50:38 +03:00
parent 72fd3c1ae9
commit bbc77b649c

View File

@ -547,6 +547,8 @@ class BarbicanKeyManager(key_manager.KeyManager):
time_stamp = timeutils.parse_isotime( time_stamp = timeutils.parse_isotime(
str(secret.created)).timetuple() str(secret.created)).timetuple()
created = calendar.timegm(time_stamp) created = calendar.timegm(time_stamp)
else:
created = None
if issubclass(secret_type, key_base_class.Key): if issubclass(secret_type, key_base_class.Key):
return secret_type(algorithm=secret.algorithm, return secret_type(algorithm=secret.algorithm,