Merge "Define keymaster log routes on the class"

This commit is contained in:
Zuul 2018-07-30 02:15:20 +00:00 committed by Gerrit Code Review
commit d97673cf54
3 changed files with 7 additions and 8 deletions

View File

@ -18,7 +18,7 @@ import os
from swift.common.middleware.crypto.crypto_utils import CRYPTO_KEY_CALLBACK
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
@ -106,9 +106,11 @@ class KeyMaster(object):
random number generator. Changing the root secret is likely to result in
data loss.
"""
log_route = 'keymaster'
def __init__(self, app, conf):
self.app = app
self.logger = get_logger(conf, log_route=self.log_route)
self.keymaster_config_path = conf.get('keymaster_config_path')
# The _get_root_secret() function is overridden by other keymasters
self.root_secret = self._get_root_secret(conf)

View File

@ -17,7 +17,7 @@ import logging
import os
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
@ -79,8 +79,9 @@ example::
class KmipKeyMaster(keymaster.KeyMaster):
log_route = 'kmip_keymaster'
def _get_root_secret(self, conf):
self.logger = get_logger(conf, log_route='kmip_keymaster')
if self.keymaster_config_path:
keymaster_opts = ['host', 'port', 'certfile', 'keyfile',
'ca_certs', 'username', 'password', 'key_id']

View File

@ -28,11 +28,7 @@ class KmsKeyMaster(KeyMaster):
proxy-server.conf file, or in the configuration pointed to using the
keymaster_config_path configuration value in the proxy-server.conf file.
"""
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)
log_route = 'kms_keymaster'
def _get_root_secret(self, conf):
"""