[python-keystoneclient/f19] Config value for revocation list timeout.

Jakub Ruzicka jruzicka at fedoraproject.org
Thu May 2 19:38:08 UTC 2013


commit 080c4fd0d3e169e6ecabc32e1aace313d6b268db
Author: Jakub Ruzicka <jruzicka at redhat.com>
Date:   Thu May 2 21:32:16 2013 +0200

    Config value for revocation list timeout.
    
    Resolves: rhbz#923519

 ...-Config-value-for-revocation-list-timeout.patch |   82 ++++++++++++++++++++
 python-keystoneclient.spec                         |    9 ++-
 2 files changed, 90 insertions(+), 1 deletions(-)
---
diff --git a/0001-Config-value-for-revocation-list-timeout.patch b/0001-Config-value-for-revocation-list-timeout.patch
new file mode 100644
index 0000000..fb6856b
--- /dev/null
+++ b/0001-Config-value-for-revocation-list-timeout.patch
@@ -0,0 +1,82 @@
+From 3a3e2540ff10a78ca9b4dde98671f6fd970e6568 Mon Sep 17 00:00:00 2001
+From: Adam Young <ayoung at redhat.com>
+Date: Tue, 19 Mar 2013 13:20:17 -0400
+Subject: [PATCH] Config value for revocation list timeout
+
+Adds the config option 'revocation_cache_time'
+default of 300 seconds, same as token timeout
+
+Bug 1076083
+
+DocImpact
+
+Change-Id: Ifd41c816dd5431f140461d6a1588364d7ecf9a62
+---
+ keystoneclient/middleware/auth_token.py |  5 +++--
+ tests/test_auth_token_middleware.py     | 16 +++++++++++++---
+ 2 files changed, 16 insertions(+), 5 deletions(-)
+
+diff --git a/keystoneclient/middleware/auth_token.py b/keystoneclient/middleware/auth_token.py
+index 98a427b..694089c 100644
+--- a/keystoneclient/middleware/auth_token.py
++++ b/keystoneclient/middleware/auth_token.py
+@@ -215,6 +215,7 @@ opts = [
+                default=os.path.expanduser('~/keystone-signing')),
+     cfg.ListOpt('memcache_servers'),
+     cfg.IntOpt('token_cache_time', default=300),
++    cfg.IntOpt('revocation_cache_time', default=1),
+     cfg.StrOpt('memcache_security_strategy', default=None),
+     cfg.StrOpt('memcache_secret_key', default=None, secret=True)
+ ]
+@@ -337,8 +338,8 @@ class AuthProtocol(object):
+         self.token_cache_time = int(self._conf_get('token_cache_time'))
+         self._token_revocation_list = None
+         self._token_revocation_list_fetched_time = None
+-        cache_timeout = datetime.timedelta(seconds=0)
+-        self.token_revocation_list_cache_timeout = cache_timeout
++        self.token_revocation_list_cache_timeout = datetime.timedelta(
++            seconds=self._conf_get('revocation_cache_time'))
+         http_connect_timeout_cfg = self._conf_get('http_connect_timeout')
+         self.http_connect_timeout = (http_connect_timeout_cfg and
+                                      int(http_connect_timeout_cfg))
+diff --git a/tests/test_auth_token_middleware.py b/tests/test_auth_token_middleware.py
+index 59f3d22..f2615d6 100644
+--- a/tests/test_auth_token_middleware.py
++++ b/tests/test_auth_token_middleware.py
+@@ -625,8 +625,6 @@ class BaseAuthTokenMiddlewareTest(testtools.TestCase):
+         self.middleware = auth_token.AuthProtocol(fake_app(expected_env), conf)
+         self.middleware._iso8601 = iso8601
+         self.middleware.revoked_file_name = tempfile.mkstemp()[1]
+-        cache_timeout = datetime.timedelta(days=1)
+-        self.middleware.token_revocation_list_cache_timeout = cache_timeout
+         self.middleware.token_revocation_list = jsonutils.dumps(
+             {"revoked": [], "extra": "success"})
+ 
+@@ -748,7 +746,8 @@ class AuthTokenMiddlewareTest(test.NoModule, BaseAuthTokenMiddlewareTest):
+     def test_init_does_not_call_http(self):
+         conf = {
+             'auth_host': 'keystone.example.com',
+-            'auth_port': 1234
++            'auth_port': 1234,
++            'revocation_cache_time': 1
+         }
+         self.set_fake_http(RaisingHTTPConnection)
+         self.set_middleware(conf=conf, fake_http=RaisingHTTPConnection)
+@@ -1165,6 +1164,17 @@ class AuthTokenMiddlewareTest(test.NoModule, BaseAuthTokenMiddlewareTest):
+         }
+         self.assertRaises(Exception, self.set_middleware, conf)
+ 
++    def test_config_revocation_cache_timeout(self):
++        conf = {
++                'auth_host': 'keystone.example.com',
++                'auth_port': 1234,
++                'auth_admin_prefix': '/testadmin',
++                'revocation_cache_time': 24
++        }
++        middleware = auth_token.AuthProtocol(self.fake_app, conf)
++        self.assertEquals(middleware.token_revocation_list_cache_timeout,
++                          datetime.timedelta(seconds=24))
++
+ 
+ class v2AuthTokenMiddlewareTest(test.NoModule, BaseAuthTokenMiddlewareTest):
+     """ v2 token specific tests.
diff --git a/python-keystoneclient.spec b/python-keystoneclient.spec
index 26ccba7..6d6ed58 100644
--- a/python-keystoneclient.spec
+++ b/python-keystoneclient.spec
@@ -4,7 +4,7 @@ Name:       python-keystoneclient
 # https://lists.launchpad.net/openstack/msg14248.html
 Epoch:      1
 Version:    0.2.3
-Release:    2%{?dist}
+Release:    3%{?dist}
 Summary:    Client library for OpenStack Identity API
 License:    ASL 2.0
 URL:        http://pypi.python.org/pypi/%{name}
@@ -13,6 +13,7 @@ Source0:    http://pypi.python.org/packages/source/p/%{name}/%{name}-%{version}.
 #
 # patches_base=0.2.3
 #
+Patch0001: 0001-Config-value-for-revocation-list-timeout.patch
 
 BuildArch:  noarch
 
@@ -48,6 +49,9 @@ Identity API.
 
 %prep
 %setup -q
+
+%patch0001 -p1
+
 # Remove bundled egg-info
 rm -rf python_keystoneclient.egg-info
 # let RPM handle deps
@@ -82,6 +86,9 @@ rm -fr doc/build/html/.doctrees doc/build/html/.buildinfo
 %doc LICENSE doc/build/html
 
 %changelog
+* Thu May 02 2013 Jakub Ruzicka <jruzicka at redhat.com> 0.2.3-3
+- Config value for revocation list timeout. (#923519)
+
 * Thu Apr 04 2013 Jakub Ruzicka <jruzicka at redhat.com> 0.2.3-2
 - Update requires. (#948244)
 


More information about the scm-commits mailing list