summaryrefslogtreecommitdiffstats
path: root/keystone/middleware
diff options
context:
space:
mode:
authorJamie Lennox <jlennox@redhat.com>2013-05-30 17:48:04 +1000
committerAdam Young <ayoung@redhat.com>2013-06-18 14:10:36 -0400
commit3afd9791ef3e2472987cdabb54ef5f27a062469c (patch)
treee4bb40f0431bd3061a9fc6ea66f8df5aa6be067e /keystone/middleware
parenta012186bb68c5514dda87f1e045983a3c2e5b236 (diff)
downloadkeystone-3afd9791ef3e2472987cdabb54ef5f27a062469c.tar.gz
keystone-3afd9791ef3e2472987cdabb54ef5f27a062469c.tar.xz
keystone-3afd9791ef3e2472987cdabb54ef5f27a062469c.zip
Isolate eventlet code into environment.
The environment module will be configured once, during code initialization. Subsequently all other possibly-evented modules will retrieve from environment and transparently obtain either the eventlet or standard library modules. If eventlet, httplib, subprocess or other environment dependant module is referenced outside of the environment module it should be considered a bug. The changes to tests are required to ensure that test is imported first to setup the environment. Hopefully these can all be replaced with an __init__.py in a post-nose keystone. Implements: blueprint extract-eventlet Change-Id: Icacd6f2ee0906ac5d303777c1f87a184f38283bf
Diffstat (limited to 'keystone/middleware')
-rw-r--r--keystone/middleware/ec2_token.py6
-rw-r--r--keystone/middleware/s3_token.py10
2 files changed, 8 insertions, 8 deletions
diff --git a/keystone/middleware/ec2_token.py b/keystone/middleware/ec2_token.py
index 7cd007c7..265ccaa6 100644
--- a/keystone/middleware/ec2_token.py
+++ b/keystone/middleware/ec2_token.py
@@ -24,7 +24,6 @@ Starting point for routing EC2 requests.
import urlparse
-from eventlet.green import httplib
import webob.dec
import webob.exc
@@ -32,6 +31,7 @@ from nova import flags
from nova import utils
from nova import wsgi
+from keystone.common import environment
FLAGS = flags.FLAGS
flags.DEFINE_string('keystone_ec2_url',
@@ -75,9 +75,9 @@ class EC2Token(wsgi.Middleware):
# pylint: disable-msg=E1101
o = urlparse.urlparse(FLAGS.keystone_ec2_url)
if o.scheme == 'http':
- conn = httplib.HTTPConnection(o.netloc)
+ conn = environment.httplib.HTTPConnection(o.netloc)
else:
- conn = httplib.HTTPSConnection(o.netloc)
+ conn = environment.httplib.HTTPSConnection(o.netloc)
conn.request('POST', o.path, body=creds_json, headers=headers)
response = conn.getresponse().read()
conn.close()
diff --git a/keystone/middleware/s3_token.py b/keystone/middleware/s3_token.py
index 74be5864..a5eff289 100644
--- a/keystone/middleware/s3_token.py
+++ b/keystone/middleware/s3_token.py
@@ -33,13 +33,13 @@ This WSGI component:
"""
-import httplib
-
import webob
-from keystone.openstack.common import jsonutils
from swift.common import utils as swift_utils
+from keystone.common import environment
+from keystone.openstack.common import jsonutils
+
PROTOCOL_NAME = 'S3 Token Authentication'
@@ -62,9 +62,9 @@ class S3Token(object):
self.auth_port = int(conf.get('auth_port', 35357))
self.auth_protocol = conf.get('auth_protocol', 'https')
if self.auth_protocol == 'http':
- self.http_client_class = httplib.HTTPConnection
+ self.http_client_class = environment.httplib.HTTPConnection
else:
- self.http_client_class = httplib.HTTPSConnection
+ self.http_client_class = environment.httplib.HTTPSConnection
# SSL
self.cert_file = conf.get('certfile')
self.key_file = conf.get('keyfile')