diff options
author | Jamie Lennox <jlennox@redhat.com> | 2013-05-30 17:48:04 +1000 |
---|---|---|
committer | Adam Young <ayoung@redhat.com> | 2013-06-18 14:10:36 -0400 |
commit | 3afd9791ef3e2472987cdabb54ef5f27a062469c (patch) | |
tree | e4bb40f0431bd3061a9fc6ea66f8df5aa6be067e /bin | |
parent | a012186bb68c5514dda87f1e045983a3c2e5b236 (diff) | |
download | keystone-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 'bin')
-rwxr-xr-x | bin/keystone-all | 12 | ||||
-rwxr-xr-x | bin/keystone-manage | 2 |
2 files changed, 6 insertions, 8 deletions
diff --git a/bin/keystone-all b/bin/keystone-all index 7e6711b5..53b50199 100755 --- a/bin/keystone-all +++ b/bin/keystone-all @@ -1,7 +1,6 @@ #!/usr/bin/env python # vim: tabstop=4 shiftwidth=4 softtabstop=4 -import greenlet import logging import os import signal @@ -21,8 +20,8 @@ if os.path.exists(os.path.join(possible_topdir, from paste import deploy import pbr.version +from keystone.common import environment from keystone.common import utils -from keystone.common import wsgi_server from keystone import config from keystone.openstack.common import gettextutils from keystone.openstack.common import importutils @@ -33,7 +32,7 @@ CONF = config.CONF def create_server(conf, name, host, port): app = deploy.loadapp('config:%s' % conf, name=name) - server = wsgi_server.Server(app, host=host, port=port) + server = environment.Server(app, host=host, port=port) if CONF.ssl.enable: server.set_ssl(CONF.ssl.certfile, CONF.ssl.keyfile, CONF.ssl.ca_certs, CONF.ssl.cert_required) @@ -64,10 +63,7 @@ def serve(*servers): logging.exception('Failed to execute onready command') for server in servers: - try: - server.wait() - except greenlet.GreenletExit: - pass + server.wait() if __name__ == '__main__': @@ -100,7 +96,7 @@ if __name__ == '__main__': # http://lists.openstack.org/pipermail/openstack-dev/2012-August/ # 000794.html monkeypatch_thread = False - wsgi_server.monkey_patch_eventlet(monkeypatch_thread=monkeypatch_thread) + environment.use_eventlet(monkeypatch_thread) servers = [] servers.append(create_server(paste_config, diff --git a/bin/keystone-manage b/bin/keystone-manage index 89ada5bd..3eedea3b 100755 --- a/bin/keystone-manage +++ b/bin/keystone-manage @@ -14,11 +14,13 @@ if os.path.exists(os.path.join(possible_topdir, sys.path.insert(0, possible_topdir) from keystone import cli +from keystone.common import environment from keystone.openstack.common import gettextutils if __name__ == '__main__': gettextutils.install('keystone') + environment.use_stdlib() dev_conf = os.path.join(possible_topdir, 'etc', |