diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-12-24 03:46:16 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-12-24 03:46:16 +0000 |
| commit | daf3bdae226a76926a8a877e1ed4bd7046f9192d (patch) | |
| tree | 02344e7e066643ef623bf15413a56de5f99d9609 | |
| parent | 1b3b6428225d16162bcb9d44ab628bccd9f219b4 (diff) | |
| parent | 0f225743e8644416df2f200d710912c40b7acd47 (diff) | |
Merge "Adding a means to connect back to a pydevd debugger."
| -rwxr-xr-x | bin/keystone-all | 7 | ||||
| -rw-r--r-- | keystone/common/utils.py | 19 | ||||
| -rw-r--r-- | keystone/config.py | 3 |
3 files changed, 29 insertions, 0 deletions
diff --git a/bin/keystone-all b/bin/keystone-all index bcb9f4f9..ca700110 100755 --- a/bin/keystone-all +++ b/bin/keystone-all @@ -91,6 +91,13 @@ if __name__ == '__main__': sys.exit(1) monkeypatch_thread = not CONF.standard_threads + pydev_debug_url = utils.setup_remote_pydev_debug() + if pydev_debug_url: + # in order to work around errors caused by monkey patching we have to + # set the thread to False. An explanation is here: + # http://lists.openstack.org/pipermail/openstack-dev/2012-August/ + # 000794.html + monkeypatch_thread = False eventlet.patcher.monkey_patch(all=False, socket=True, time=True, thread=monkeypatch_thread) diff --git a/keystone/common/utils.py b/keystone/common/utils.py index 5acb901d..fadfa893 100644 --- a/keystone/common/utils.py +++ b/keystone/common/utils.py @@ -292,3 +292,22 @@ def hash_signed_token(signed_text): hash_ = hashlib.md5() hash_.update(signed_text) return hash_.hexdigest() + + +def setup_remote_pydev_debug(): + if CONF.pydev_debug_host and CONF.pydev_debug_port: + error_msg = ('Error setting up the debug environment. Verify that the' + ' option --debug-url has the format <host>:<port> and ' + 'that a debugger processes is listening on that port.') + + try: + from pydev import pydevd + + pydevd.settrace(CONF.pydev_debug_host, + port=CONF.pydev_debug_port, + stdoutToServer=True, + stderrToServer=True) + return True + except: + LOG.exception(_(error_msg)) + raise diff --git a/keystone/config.py b/keystone/config.py index f5e2fcf8..9d4da38a 100644 --- a/keystone/config.py +++ b/keystone/config.py @@ -125,6 +125,9 @@ def register_cli_int(*args, **kw): register_cli_bool('standard-threads', default=False) +register_cli_str('pydev-debug-host', default=None) +register_cli_int('pydev-debug-port', default=None) + register_str('admin_token', default='ADMIN') register_str('bind_host', default='0.0.0.0') register_str('compute_port', default=8774) |
