Fix interaction between gitpython and eventlet
The mistral executor uses eventlet patching, but gitpython's subprocess module is not being properly patched. Patching it manually fix the issues Change-Id: I49d041b48d9939844bcc3a571819887772caf491 Closes-bug: #1818757
This commit is contained in:
parent
6f88e900a0
commit
1af49b1966
@ -5,6 +5,7 @@
|
|||||||
pbr!=2.1.0,>=2.0.0 # Apache-2.0
|
pbr!=2.1.0,>=2.0.0 # Apache-2.0
|
||||||
Babel!=2.4.0,>=2.3.4 # BSD
|
Babel!=2.4.0,>=2.3.4 # BSD
|
||||||
GitPython>=1.0.1 # BSD License (3 clause)
|
GitPython>=1.0.1 # BSD License (3 clause)
|
||||||
|
eventlet!=0.20.1,>=0.20.0 # MIT
|
||||||
python-heatclient>=1.10.0 # Apache-2.0
|
python-heatclient>=1.10.0 # Apache-2.0
|
||||||
oslo.config>=5.2.0 # Apache-2.0
|
oslo.config>=5.2.0 # Apache-2.0
|
||||||
oslo.log>=3.36.0 # Apache-2.0
|
oslo.log>=3.36.0 # Apache-2.0
|
||||||
|
@ -17,10 +17,11 @@ import logging
|
|||||||
import shutil
|
import shutil
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
from git import Repo
|
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from mistral_lib import actions
|
from mistral_lib import actions
|
||||||
|
from tripleo_common.utils.safe_import import Repo
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -18,11 +18,11 @@ import shutil
|
|||||||
import tempfile
|
import tempfile
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
import git
|
|
||||||
from mistral_lib import actions
|
from mistral_lib import actions
|
||||||
|
|
||||||
from tripleo_common.actions import vcs
|
from tripleo_common.actions import vcs
|
||||||
from tripleo_common.tests import base
|
from tripleo_common.tests import base
|
||||||
|
from tripleo_common.utils.safe_import import git
|
||||||
|
|
||||||
|
|
||||||
class GitCloneActionTest(base.TestCase):
|
class GitCloneActionTest(base.TestCase):
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import fixtures
|
import fixtures
|
||||||
import git
|
|
||||||
import mock
|
import mock
|
||||||
import os
|
import os
|
||||||
import uuid
|
import uuid
|
||||||
@ -26,6 +25,7 @@ from tripleo_common import constants
|
|||||||
from tripleo_common.tests import base
|
from tripleo_common.tests import base
|
||||||
from tripleo_common.tests.fake_config import fakes
|
from tripleo_common.tests.fake_config import fakes
|
||||||
from tripleo_common.utils import config as ooo_config
|
from tripleo_common.utils import config as ooo_config
|
||||||
|
from tripleo_common.utils.safe_import import git
|
||||||
|
|
||||||
|
|
||||||
class TestConfig(base.TestCase):
|
class TestConfig(base.TestCase):
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
import git
|
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
@ -25,7 +25,7 @@ import yaml
|
|||||||
import jinja2
|
import jinja2
|
||||||
|
|
||||||
from tripleo_common import constants
|
from tripleo_common import constants
|
||||||
|
from tripleo_common.utils.safe_import import git
|
||||||
|
|
||||||
warnings.filterwarnings('once')
|
warnings.filterwarnings('once')
|
||||||
|
|
||||||
|
28
tripleo_common/utils/safe_import.py
Normal file
28
tripleo_common/utils/safe_import.py
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
# Copyright 2019 Red Hat, Inc.
|
||||||
|
# All Rights Reserved.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
|
||||||
|
import eventlet
|
||||||
|
from eventlet.green import subprocess
|
||||||
|
|
||||||
|
# Due to an eventlet issue subprocess is not being correctly patched
|
||||||
|
# on git module so it has to be done manually
|
||||||
|
|
||||||
|
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')
|
Loading…
Reference in New Issue
Block a user