Change memcache config entry name in Keystone to be consistent with Oslo

Currently, Keystone-Client is using 'memcache_servers' config option to store
the memcache server info, while in OSLO project, it is using 'memcached_servers'
to config the same option. It is better to change keystone-client's
'memcache_servers' to 'memcached_servers' to keep consistent between these two
projects.

Change-Id: I93ca0aa368f95a3ccf6de6984262057e61f75ffe
Fixes: Bug 1172793
This commit is contained in:
xingzhou
2013-06-04 01:44:09 -04:00
parent eeefb784f2
commit abe6781913
3 changed files with 16 additions and 15 deletions

View File

@@ -134,7 +134,7 @@ a WSGI component. Example for the auth_token middleware::
;Uncomment next line to use Swift MemcacheRing ;Uncomment next line to use Swift MemcacheRing
;cache = swift.cache ;cache = swift.cache
;Uncomment next line and check ip:port to use memcached to cache tokens ;Uncomment next line and check ip:port to use memcached to cache tokens
;memcache_servers = 127.0.0.1:11211 ;memcached_servers = 127.0.0.1:11211
;Uncomment next 2 lines to turn on memcache protection ;Uncomment next 2 lines to turn on memcache protection
;memcache_security_strategy = ENCRYPT ;memcache_security_strategy = ENCRYPT
;memcache_secret_key = change_me ;memcache_secret_key = change_me
@@ -203,7 +203,7 @@ invalidated tokens may continue to work if they are still in the token cache,
so token_cache_time is configurable. For larger deployments, the middleware so token_cache_time is configurable. For larger deployments, the middleware
also supports memcache based caching. also supports memcache based caching.
* ``memcache_servers``: (optonal) if defined, the memcache server(s) to use for * ``memcached_servers``: (optonal) if defined, the memcache server(s) to use for
cacheing. It will be ignored if Swift MemcacheRing is used instead. cacheing. It will be ignored if Swift MemcacheRing is used instead.
* ``token_cache_time``: (optional, default 300 seconds) Set to -1 to disable * ``token_cache_time``: (optional, default 300 seconds) Set to -1 to disable
caching completely. caching completely.

View File

@@ -213,7 +213,7 @@ opts = [
cfg.StrOpt('certfile'), cfg.StrOpt('certfile'),
cfg.StrOpt('keyfile'), cfg.StrOpt('keyfile'),
cfg.StrOpt('signing_dir'), cfg.StrOpt('signing_dir'),
cfg.ListOpt('memcache_servers'), cfg.ListOpt('memcached_servers', deprecated_name='memcache_servers'),
cfg.IntOpt('token_cache_time', default=300), cfg.IntOpt('token_cache_time', default=300),
cfg.IntOpt('revocation_cache_time', default=1), cfg.IntOpt('revocation_cache_time', default=1),
cfg.StrOpt('memcache_security_strategy', default=None), cfg.StrOpt('memcache_security_strategy', default=None),
@@ -364,7 +364,8 @@ class AuthProtocol(object):
def _init_cache(self, env): def _init_cache(self, env):
cache = self._conf_get('cache') cache = self._conf_get('cache')
memcache_servers = self._conf_get('memcache_servers') memcache_servers = self._conf_get('memcached_servers')
if cache and env.get(cache, None) is not None: if cache and env.get(cache, None) is not None:
# use the cache from the upstream filter # use the cache from the upstream filter
self.LOG.info('Using %s memcache for caching token', cache) self.LOG.info('Using %s memcache for caching token', cache)

View File

@@ -805,7 +805,7 @@ class NoMemcacheAuthToken(BaseAuthTokenMiddlewareTest):
'admin_token': 'admin_token1', 'admin_token': 'admin_token1',
'auth_host': 'keystone.example.com', 'auth_host': 'keystone.example.com',
'auth_port': 1234, 'auth_port': 1234,
'memcache_servers': 'localhost:11211', 'memcached_servers': 'localhost:11211',
} }
auth_token.AuthProtocol(FakeApp(), conf) auth_token.AuthProtocol(FakeApp(), conf)
@@ -816,7 +816,7 @@ class NoMemcacheAuthToken(BaseAuthTokenMiddlewareTest):
'auth_host': 'keystone.example.com', 'auth_host': 'keystone.example.com',
'auth_port': 1234, 'auth_port': 1234,
'auth_admin_prefix': '/testadmin', 'auth_admin_prefix': '/testadmin',
'memcache_servers': 'localhost:11211' 'memcached_servers': 'localhost:11211'
} }
self.set_middleware(conf=conf) self.set_middleware(conf=conf)
self.middleware._init_cache(env) self.middleware._init_cache(env)
@@ -1070,7 +1070,7 @@ class AuthTokenMiddlewareTest(BaseAuthTokenMiddlewareTest):
'auth_port': 1234, 'auth_port': 1234,
'auth_admin_prefix': '/testadmin', 'auth_admin_prefix': '/testadmin',
'cache': 'swift.cache', 'cache': 'swift.cache',
'memcache_servers': ['localhost:11211'] 'memcached_servers': ['localhost:11211']
} }
self.set_middleware(conf=conf) self.set_middleware(conf=conf)
self.middleware._init_cache(env) self.middleware._init_cache(env)
@@ -1089,7 +1089,7 @@ class AuthTokenMiddlewareTest(BaseAuthTokenMiddlewareTest):
'auth_host': 'keystone.example.com', 'auth_host': 'keystone.example.com',
'auth_port': 1234, 'auth_port': 1234,
'auth_admin_prefix': '/testadmin', 'auth_admin_prefix': '/testadmin',
'memcache_servers': ['localhost:11211'], 'memcached_servers': ['localhost:11211'],
'memcache_security_strategy': 'encrypt', 'memcache_security_strategy': 'encrypt',
'memcache_secret_key': 'mysecret' 'memcache_secret_key': 'mysecret'
} }
@@ -1105,7 +1105,7 @@ class AuthTokenMiddlewareTest(BaseAuthTokenMiddlewareTest):
'auth_host': 'keystone.example.com', 'auth_host': 'keystone.example.com',
'auth_port': 1234, 'auth_port': 1234,
'auth_admin_prefix': '/testadmin', 'auth_admin_prefix': '/testadmin',
'memcache_servers': ['localhost:11211'], 'memcached_servers': ['localhost:11211'],
'memcache_security_strategy': 'mac', 'memcache_security_strategy': 'mac',
'memcache_secret_key': 'mysecret' 'memcache_secret_key': 'mysecret'
} }
@@ -1121,7 +1121,7 @@ class AuthTokenMiddlewareTest(BaseAuthTokenMiddlewareTest):
'auth_host': 'keystone.example.com', 'auth_host': 'keystone.example.com',
'auth_port': 1234, 'auth_port': 1234,
'auth_admin_prefix': '/testadmin', 'auth_admin_prefix': '/testadmin',
'memcache_servers': ['localhost:11211'], 'memcached_servers': ['localhost:11211'],
'memcache_secret_key': 'mysecret' 'memcache_secret_key': 'mysecret'
} }
self.set_middleware(conf=conf) self.set_middleware(conf=conf)
@@ -1137,7 +1137,7 @@ class AuthTokenMiddlewareTest(BaseAuthTokenMiddlewareTest):
'auth_host': 'keystone.example.com', 'auth_host': 'keystone.example.com',
'auth_port': 1234, 'auth_port': 1234,
'auth_admin_prefix': '/testadmin', 'auth_admin_prefix': '/testadmin',
'memcache_servers': ['localhost:11211'], 'memcached_servers': ['localhost:11211'],
'memcache_security_strategy': 'Encrypt' 'memcache_security_strategy': 'Encrypt'
} }
self.assertRaises(Exception, self.set_middleware, conf) self.assertRaises(Exception, self.set_middleware, conf)
@@ -1146,7 +1146,7 @@ class AuthTokenMiddlewareTest(BaseAuthTokenMiddlewareTest):
'auth_host': 'keystone.example.com', 'auth_host': 'keystone.example.com',
'auth_port': 1234, 'auth_port': 1234,
'auth_admin_prefix': '/testadmin', 'auth_admin_prefix': '/testadmin',
'memcache_servers': ['localhost:11211'], 'memcached_servers': ['localhost:11211'],
'memcache_security_strategy': 'whatever' 'memcache_security_strategy': 'whatever'
} }
self.assertRaises(Exception, self.set_middleware, conf) self.assertRaises(Exception, self.set_middleware, conf)
@@ -1155,7 +1155,7 @@ class AuthTokenMiddlewareTest(BaseAuthTokenMiddlewareTest):
'auth_host': 'keystone.example.com', 'auth_host': 'keystone.example.com',
'auth_port': 1234, 'auth_port': 1234,
'auth_admin_prefix': '/testadmin', 'auth_admin_prefix': '/testadmin',
'memcache_servers': ['localhost:11211'], 'memcached_servers': ['localhost:11211'],
'memcache_security_strategy': 'mac' 'memcache_security_strategy': 'mac'
} }
self.assertRaises(Exception, self.set_middleware, conf) self.assertRaises(Exception, self.set_middleware, conf)
@@ -1163,7 +1163,7 @@ class AuthTokenMiddlewareTest(BaseAuthTokenMiddlewareTest):
'auth_host': 'keystone.example.com', 'auth_host': 'keystone.example.com',
'auth_port': 1234, 'auth_port': 1234,
'auth_admin_prefix': '/testadmin', 'auth_admin_prefix': '/testadmin',
'memcache_servers': ['localhost:11211'], 'memcached_servers': ['localhost:11211'],
'memcache_security_strategy': 'Encrypt', 'memcache_security_strategy': 'Encrypt',
'memcache_secret_key': '' 'memcache_secret_key': ''
} }
@@ -1172,7 +1172,7 @@ class AuthTokenMiddlewareTest(BaseAuthTokenMiddlewareTest):
'auth_host': 'keystone.example.com', 'auth_host': 'keystone.example.com',
'auth_port': 1234, 'auth_port': 1234,
'auth_admin_prefix': '/testadmin', 'auth_admin_prefix': '/testadmin',
'memcache_servers': ['localhost:11211'], 'memcached_servers': ['localhost:11211'],
'memcache_security_strategy': 'mAc', 'memcache_security_strategy': 'mAc',
'memcache_secret_key': '' 'memcache_secret_key': ''
} }