From 81cb2ab2f5b7bdcd372491731750687e31c15ae2 Mon Sep 17 00:00:00 2001 From: Adam Young Date: Tue, 3 Jul 2012 16:22:13 -0400 Subject: [PATCH] Move monkey patch to keystone-all startup. bug 1020569 Change-Id: I26c467dc6d96476f2a44b875bddf2cf3aec41859 --- bin/keystone-all | 3 +++ keystone/common/wsgi.py | 1 - run_tests.py | 9 +++++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/bin/keystone-all b/bin/keystone-all index fc49996721..8942ec47d4 100755 --- a/bin/keystone-all +++ b/bin/keystone-all @@ -2,6 +2,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 import greenlet +import eventlet import logging import os import signal @@ -17,6 +18,8 @@ if os.path.exists(os.path.join(possible_topdir, '__init__.py')): sys.path.insert(0, possible_topdir) +eventlet.patcher.monkey_patch(all=False, socket=True, time=True, thread=True) + from paste import deploy from keystone import config diff --git a/keystone/common/wsgi.py b/keystone/common/wsgi.py index e2606c5324..3d06abe415 100644 --- a/keystone/common/wsgi.py +++ b/keystone/common/wsgi.py @@ -23,7 +23,6 @@ import sys import eventlet.wsgi -eventlet.patcher.monkey_patch(all=False, socket=True, time=True, thread=True) import routes.middleware import ssl import webob.dec diff --git a/run_tests.py b/run_tests.py index 25ad7dc888..fb7b1cac19 100644 --- a/run_tests.py +++ b/run_tests.py @@ -55,7 +55,7 @@ To run a single test module: python run_tests.py api.test_wsgi """ - +import eventlet import heapq import os import unittest @@ -337,6 +337,7 @@ if __name__ == '__main__': # If any argument looks like a test name but doesn't have "nova.tests" in # front of it, automatically add that so we don't have to type as much show_elapsed = True + do_monkeypatch = True argv = [] for x in sys.argv: if x.startswith('test_'): @@ -345,9 +346,13 @@ if __name__ == '__main__': argv.append(x) elif x.startswith('--hide-elapsed'): show_elapsed = False + elif x.startswith('--no-monkeypatch'): + do_monkeypatch = False else: argv.append(x) - + if do_monkeypatch: + eventlet.patcher.monkey_patch(all=False, socket=True, time=True, + thread=True) testdir = os.path.abspath(os.path.join("tests")) c = config.Config(stream=sys.stdout, env=os.environ,