memcache: Remove "default" username and password
Because these are not intentional default. This also adds a validation logic to catch the case where SASL is requested but username or password is not given. Change-Id: Ia98bfc5f9a42c13acfdb2192bb1fa11773f6ccf8
This commit is contained in:
parent
33244f6aae
commit
ced97d218b
@ -122,10 +122,8 @@ FILE_OPTIONS = {
|
|||||||
help='Enable the SASL(Simple Authentication and Security'
|
help='Enable the SASL(Simple Authentication and Security'
|
||||||
'Layer) if the SASL_enable is true, else disable.'),
|
'Layer) if the SASL_enable is true, else disable.'),
|
||||||
cfg.StrOpt('memcache_username',
|
cfg.StrOpt('memcache_username',
|
||||||
default='',
|
|
||||||
help='the user name for the memcached which SASL enabled'),
|
help='the user name for the memcached which SASL enabled'),
|
||||||
cfg.StrOpt('memcache_password',
|
cfg.StrOpt('memcache_password',
|
||||||
default='',
|
|
||||||
secret=True,
|
secret=True,
|
||||||
help='the password for the memcached which SASL enabled'),
|
help='the password for the memcached which SASL enabled'),
|
||||||
cfg.BoolOpt('tls_enabled',
|
cfg.BoolOpt('tls_enabled',
|
||||||
|
@ -27,6 +27,7 @@ except ImportError as e:
|
|||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
from oslo_cache import _memcache_pool
|
from oslo_cache import _memcache_pool
|
||||||
|
from oslo_cache import exception
|
||||||
|
|
||||||
|
|
||||||
# Helper to ease backend refactoring
|
# Helper to ease backend refactoring
|
||||||
@ -63,6 +64,11 @@ class PooledMemcachedBackend(memcached_backend.MemcachedBackend):
|
|||||||
def __init__(self, arguments):
|
def __init__(self, arguments):
|
||||||
super(PooledMemcachedBackend, self).__init__(arguments)
|
super(PooledMemcachedBackend, self).__init__(arguments)
|
||||||
if arguments.get('sasl_enabled', False):
|
if arguments.get('sasl_enabled', False):
|
||||||
|
if (arguments.get('username') is None or
|
||||||
|
arguments.get('password') is None):
|
||||||
|
raise exception.ConfigurationError(
|
||||||
|
'username and password should be configured to use SASL '
|
||||||
|
'authentication.')
|
||||||
if not _bmemcache_pool:
|
if not _bmemcache_pool:
|
||||||
raise ImportError("python-binary-memcached package is missing")
|
raise ImportError("python-binary-memcached package is missing")
|
||||||
self.client_pool = _bmemcache_pool.BMemcacheClientPool(
|
self.client_pool = _bmemcache_pool.BMemcacheClientPool(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user