Make gitpython and eventlet work with eventlet 0.25.1

Version 0.25 is having a bad interaction with python git.
that is due to the way that eventlet unloads some modules now.
Changed to use the inject method that supports what we need intead
of the imported_patched that was having the problem

Change-Id: I79894d4f711c64f536593fffcb6959df97c38838
Closes-bug: #1845181
This commit is contained in:
apetrich 2019-09-24 13:20:46 +02:00 committed by yatin
parent 33cb21a89b
commit 26672e83ab
1 changed files with 7 additions and 7 deletions

View File

@ -14,15 +14,15 @@
# under the License.
import eventlet
from eventlet.green import subprocess
import eventlet.patcher as patcher
# Due to an eventlet issue subprocess is not being correctly patched
# on git module so it has to be done manually
# on git.refs
patcher.inject('git.refs', None, ('subprocess', subprocess), )
# this has to be loaded after the inject.
import git # noqa: E402
git = eventlet.import_patched('git', ('subprocess', subprocess))
Repo = git.Repo
# git.refs is lazy loaded when there's a new commit, this needs to be
# patched as well.
eventlet.import_patched('git.refs')