diff options
author | Davanum Srinivas <dims@linux.vnet.ibm.com> | 2014-07-27 21:37:30 -0400 |
---|---|---|
committer | Davanum Srinivas (dims) <davanum@gmail.com> | 2014-08-01 15:43:03 +0000 |
commit | 365aae94ccb3a37ab7b01181722c4faf95c34b4c (patch) | |
tree | 9d68aa367b643218d2b7394f67c2e9805d7bbd8b /nova/cmd | |
parent | 24a24fcf52bf22a464d8fe2a652050fd0016d6c9 (diff) | |
download | nova-365aae94ccb3a37ab7b01181722c4faf95c34b4c.tar.gz |
docs - Prevent eventlet exception during docs generation
build_sphinx has a lot of spurious tracebacks, We don't
really need this check for document generation
Change-Id: Id9442c5902918592c4c242cc66975062cf9f2461
Diffstat (limited to 'nova/cmd')
-rw-r--r-- | nova/cmd/__init__.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/nova/cmd/__init__.py b/nova/cmd/__init__.py index cbe5ae351e..5f1129d9c1 100644 --- a/nova/cmd/__init__.py +++ b/nova/cmd/__init__.py @@ -16,13 +16,18 @@ # TODO(mikal): move eventlet imports to nova.__init__ once we move to PBR import os import sys +import traceback # 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. +# NOTE(dims): Prevent this code from kicking in under docs generation +# as it leads to spurious errors/warning. +stack = traceback.extract_stack() if ('eventlet' in sys.modules and - os.environ.get('EVENTLET_NO_GREENDNS', '').lower() != 'yes'): + os.environ.get('EVENTLET_NO_GREENDNS', '').lower() != 'yes' and + (len(stack) < 2 or 'sphinx' not in stack[-2][0])): raise ImportError('eventlet imported before nova/cmd/__init__ ' '(env var set to %s)' % os.environ.get('EVENTLET_NO_GREENDNS')) |