eventlet.monkey_patch upfront in __init__

Following best practice recommendations [1], monkey_patch in
congress/server/__init__.py,
congress/cfg_validator/agent/__init__.py,
and congress/tests/__init__.py (previously done)
 to ensure all modules are patched very first thing
and no unpatched modules get used.

All other uses of eventlet.monkey_patch are removed.

[1] https://specs.openstack.org/openstack/openstack-specs/specs/eventlet-best-practices.html

Change-Id: Id98f9f9a6f21ca56dd0c1facba6ca4ea064e9352
This commit is contained in:
Eric K 2018-01-31 12:01:16 -08:00
parent 54a8abc669
commit 32549af4c6
6 changed files with 7 additions and 12 deletions

View File

@ -0,0 +1,3 @@
# NOTE(ekcs): monkey_patch upfront to ensure all imports get patched modules
import eventlet
eventlet.monkey_patch()

View File

@ -18,8 +18,6 @@ import json
import time
import eventlet
eventlet.monkey_patch()
from oslo_log import log as logging
from congress.dse2 import data_service

View File

@ -16,10 +16,6 @@
import json
import six
import eventlet
eventlet.monkey_patch() # for using oslo.messaging w/ eventlet executor
from oslo_config import cfg
from oslo_db import exception as db_exc
from oslo_log import log as logging

View File

@ -0,0 +1,3 @@
# NOTE(ekcs): monkey_patch upfront to ensure all imports get patched modules
import eventlet
eventlet.monkey_patch()

View File

@ -21,8 +21,6 @@ from __future__ import absolute_import
import socket
import sys
import eventlet
eventlet.monkey_patch()
from oslo_config import cfg
from oslo_log import log as logging
from oslo_service import service

View File

@ -29,9 +29,6 @@ import sys
import tempfile
import time
# Note: monkey patch to allow running this test standalone under 'nose'
import eventlet
eventlet.monkey_patch()
from oslo_log import log as logging
import requests
import six
@ -119,7 +116,7 @@ class TestCongressHAHT(base.SqlTestCase):
dir='/tmp')
args = [sys.executable,
'congress/server/congress_server.py',
'bin/congress-server',
'--node-id',
'node_%d' % num,
'--api',