summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorBrant Knudson <bknudson@us.ibm.com>2013-05-09 17:32:24 -0500
committerBrant Knudson <bknudson@us.ibm.com>2013-05-09 21:09:45 -0500
commit6219f94b3a1103a16bd5f16ed8ffdd41a85280e1 (patch)
tree276cb0c43e0ecbcf45e405b5c7e13f4e41af83ec /bin
parent693a486f39c9faca20383d211a7d30f6e5748168 (diff)
downloadkeystone-6219f94b3a1103a16bd5f16ed8ffdd41a85280e1.tar.gz
keystone-6219f94b3a1103a16bd5f16ed8ffdd41a85280e1.tar.xz
keystone-6219f94b3a1103a16bd5f16ed8ffdd41a85280e1.zip
Disable eventlet monkey-patching of DNS
This change avoids eventlet's monkey-patching of DNS resolution. eventlet's doesn't support IPv6, for example. The way to avoid eventlet's DNS is to set an environment variable. The trick is the environment variable needs to be set before eventlet is imported. A similar change was made in nova, so this is just copying that code and technique to keystone. This allows re-enabling the IPv6 tests, too. Change-Id: I30524a1cebd43580d692fd88ef32be45e62758c5
Diffstat (limited to 'bin')
-rwxr-xr-xbin/keystone-all15
1 files changed, 14 insertions, 1 deletions
diff --git a/bin/keystone-all b/bin/keystone-all
index 2fdc8c7a..64c6342b 100755
--- a/bin/keystone-all
+++ b/bin/keystone-all
@@ -2,12 +2,25 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
import greenlet
-import eventlet
import logging
import os
import signal
import sys
+# NOTE(mikal): All of this is because if dnspython is present in your
+# environment then eventlet monkeypatches socket.getaddrinfo() with an
+# implementation which doesn't work for IPv6. What we're checking here is
+# that the magic environment variable was set when the import happened.
+if ('eventlet' in sys.modules and
+ os.environ.get('EVENTLET_NO_GREENDNS', '').lower() != 'yes'):
+ raise ImportError('eventlet imported before keystone-all '
+ '(env var set to %s)'
+ % os.environ.get('EVENTLET_NO_GREENDNS'))
+
+os.environ['EVENTLET_NO_GREENDNS'] = 'yes'
+
+import eventlet
+
# If ../keystone/__init__.py exists, add ../ to Python search path, so that
# it will override what happens to be installed in /usr/(local/)lib/python...
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(__file__),