Use eventlet.monkey_patch() before any libs are loaded

Monkeypatching should be before everything, including imports.
This patch ensure eventlet have patched modules before they are loaded
and used.

Change-Id: I6056bdbd20c14e762702ad19c9779a4be79952b8
Closes-Bug: #1545538
This commit is contained in:
Victor Ryzhenkin 2016-02-17 14:54:02 +03:00 committed by Nikolay Starodubtsev
parent 3658e2e20a
commit 1ca4e682cf
3 changed files with 33 additions and 24 deletions

View File

@ -16,9 +16,19 @@
import os
import sys
import eventlet
if os.name == 'nt':
# eventlet monkey patching causes subprocess.Popen to fail on Windows
# when using pipes due to missing non blocking I/O support
eventlet.monkey_patch(os=False)
else:
eventlet.monkey_patch()
import sys
from oslo_config import cfg
from oslo_log import log as logging
from oslo_service import service
@ -34,13 +44,6 @@ from murano.common import wsgi
CONF = cfg.CONF
if os.name == 'nt':
# eventlet monkey patching causes subprocess.Popen to fail on Windows
# when using pipes due to missing non blocking I/O support
eventlet.monkey_patch(os=False)
else:
eventlet.monkey_patch()
# If ../murano/__init__.py exists, add ../ to Python search path, so that
# it will override what happens to be installed in /usr/(local/)lib/python...
root = os.path.join(os.path.abspath(__file__), os.pardir, os.pardir, os.pardir)

View File

@ -16,9 +16,19 @@
import os
import sys
import eventlet
if os.name == 'nt':
# eventlet monkey patching causes subprocess.Popen to fail on Windows
# when using pipes due to missing non blocking I/O support
eventlet.monkey_patch(os=False)
else:
eventlet.monkey_patch()
import sys
from oslo_config import cfg
from oslo_log import log as logging
from oslo_service import service
@ -33,13 +43,6 @@ from murano.common import wsgi
CONF = cfg.CONF
if os.name == 'nt':
# eventlet monkey patching causes subprocess.Popen to fail on Windows
# when using pipes due to missing non blocking I/O support
eventlet.monkey_patch(os=False)
else:
eventlet.monkey_patch()
# If ../murano/__init__.py exists, add ../ to Python search path, so that
# it will override what happens to be installed in /usr/(local/)lib/python...
root = os.path.join(os.path.abspath(__file__), os.pardir, os.pardir, os.pardir)

View File

@ -15,9 +15,19 @@
# under the License.
import os
import sys
import eventlet
if os.name == 'nt':
# eventlet monkey patching causes subprocess.Popen to fail on Windows
# when using pipes due to missing non blocking I/O support
eventlet.monkey_patch(os=False)
else:
eventlet.monkey_patch()
import sys
from oslo_log import log as logging
from oslo_service import service
@ -27,13 +37,6 @@ from murano.common import engine
CONF = config.CONF
if os.name == 'nt':
# eventlet monkey patching causes subprocess.Popen to fail on Windows
# when using pipes due to missing non blocking I/O support
eventlet.monkey_patch(os=False)
else:
eventlet.monkey_patch()
# If ../murano/__init__.py exists, add ../ to Python search path, so that
# it will override what happens to be installed in /usr/(local/)lib/python...
root = os.path.join(os.path.abspath(__file__), os.pardir, os.pardir, os.pardir)