Merge "Properly instantiate FernetUtils"

This commit is contained in:
Zuul 2022-02-17 18:15:40 +00:00 committed by Gerrit Code Review
commit a3fc9e7c38
2 changed files with 3 additions and 3 deletions

View File

@ -36,8 +36,8 @@ NULL_KEY = base64.urlsafe_b64encode(b'\x00' * 32)
class FernetUtils(object): class FernetUtils(object):
def __init__(self, key_repository=None, max_active_keys=None, def __init__(self, key_repository, max_active_keys,
config_group=None): config_group):
self.key_repository = key_repository self.key_repository = key_repository
self.max_active_keys = max_active_keys self.max_active_keys = max_active_keys
self.config_group = config_group self.config_group = config_group

View File

@ -96,7 +96,7 @@ class Provider(core.Provider):
:returns: a decrypted credential :returns: a decrypted credential
""" """
key_utils = fernet_utils.FernetUtils( key_utils = fernet_utils.FernetUtils(
CONF.credential.key_repository, MAX_ACTIVE_KEYS) CONF.credential.key_repository, MAX_ACTIVE_KEYS, 'credential')
keys = key_utils.load_keys(use_null_key=True) keys = key_utils.load_keys(use_null_key=True)
fernet_keys = [fernet.Fernet(key) for key in keys] fernet_keys = [fernet.Fernet(key) for key in keys]
crypto = fernet.MultiFernet(fernet_keys) crypto = fernet.MultiFernet(fernet_keys)