Define keymaster log routes on the class
... instead of having KmipKeyMaster instantiate its own logger inside of _get_root_secret. Bonus: KmsKeyMaster uses its own log route now. Bonus bonus: get rid of KmsKeyMaster's pointlessly-overriden __init__ method. Change-Id: Idb4b832e5ca0e3d749fe2c0b7ba283447a4dc69e
This commit is contained in:
parent
b15111abe7
commit
2f9bd85ae1
@ -18,7 +18,7 @@ import os
|
|||||||
|
|
||||||
from swift.common.middleware.crypto.crypto_utils import CRYPTO_KEY_CALLBACK
|
from swift.common.middleware.crypto.crypto_utils import CRYPTO_KEY_CALLBACK
|
||||||
from swift.common.swob import Request, HTTPException
|
from swift.common.swob import Request, HTTPException
|
||||||
from swift.common.utils import readconf, strict_b64decode
|
from swift.common.utils import readconf, strict_b64decode, get_logger
|
||||||
from swift.common.wsgi import WSGIContext
|
from swift.common.wsgi import WSGIContext
|
||||||
|
|
||||||
|
|
||||||
@ -106,9 +106,11 @@ class KeyMaster(object):
|
|||||||
random number generator. Changing the root secret is likely to result in
|
random number generator. Changing the root secret is likely to result in
|
||||||
data loss.
|
data loss.
|
||||||
"""
|
"""
|
||||||
|
log_route = 'keymaster'
|
||||||
|
|
||||||
def __init__(self, app, conf):
|
def __init__(self, app, conf):
|
||||||
self.app = app
|
self.app = app
|
||||||
|
self.logger = get_logger(conf, log_route=self.log_route)
|
||||||
self.keymaster_config_path = conf.get('keymaster_config_path')
|
self.keymaster_config_path = conf.get('keymaster_config_path')
|
||||||
# The _get_root_secret() function is overridden by other keymasters
|
# The _get_root_secret() function is overridden by other keymasters
|
||||||
self.root_secret = self._get_root_secret(conf)
|
self.root_secret = self._get_root_secret(conf)
|
||||||
|
@ -17,7 +17,7 @@ import logging
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
from swift.common.middleware.crypto import keymaster
|
from swift.common.middleware.crypto import keymaster
|
||||||
from swift.common.utils import readconf, get_logger
|
from swift.common.utils import readconf
|
||||||
|
|
||||||
from kmip.pie.client import ProxyKmipClient
|
from kmip.pie.client import ProxyKmipClient
|
||||||
|
|
||||||
@ -79,8 +79,9 @@ example::
|
|||||||
|
|
||||||
|
|
||||||
class KmipKeyMaster(keymaster.KeyMaster):
|
class KmipKeyMaster(keymaster.KeyMaster):
|
||||||
|
log_route = 'kmip_keymaster'
|
||||||
|
|
||||||
def _get_root_secret(self, conf):
|
def _get_root_secret(self, conf):
|
||||||
self.logger = get_logger(conf, log_route='kmip_keymaster')
|
|
||||||
if self.keymaster_config_path:
|
if self.keymaster_config_path:
|
||||||
keymaster_opts = ['host', 'port', 'certfile', 'keyfile',
|
keymaster_opts = ['host', 'port', 'certfile', 'keyfile',
|
||||||
'ca_certs', 'username', 'password', 'key_id']
|
'ca_certs', 'username', 'password', 'key_id']
|
||||||
|
@ -28,11 +28,7 @@ class KmsKeyMaster(KeyMaster):
|
|||||||
proxy-server.conf file, or in the configuration pointed to using the
|
proxy-server.conf file, or in the configuration pointed to using the
|
||||||
keymaster_config_path configuration value in the proxy-server.conf file.
|
keymaster_config_path configuration value in the proxy-server.conf file.
|
||||||
"""
|
"""
|
||||||
|
log_route = 'kms_keymaster'
|
||||||
def __init__(self, app, conf):
|
|
||||||
# Call the superclass __init__() method, which calls the overridden
|
|
||||||
# self._get_root_secret() below.
|
|
||||||
super(KmsKeyMaster, self).__init__(app, conf)
|
|
||||||
|
|
||||||
def _get_root_secret(self, conf):
|
def _get_root_secret(self, conf):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user