Switch to use process executor
We switched the tripleo-container-image-prepare script in tripleo-common, but a user will likely run the 'openstack tripleo container image prepare' command. Currently it uses the default which is the threading executor. Poke tripleo common lower/requirements as well. Change-Id: Ifc5b46633a1f9fc9378eaa17170f6664d566c3c4 Related-Bug: #1844446
This commit is contained in:
parent
315f6d4d21
commit
51d589b766
|
@ -148,7 +148,7 @@ testscenarios===0.4
|
||||||
testtools==2.2.0
|
testtools==2.2.0
|
||||||
tooz==1.58.0
|
tooz==1.58.0
|
||||||
traceback2==1.4.0
|
traceback2==1.4.0
|
||||||
tripleo-common==10.7.0
|
tripleo-common==11.3.1
|
||||||
ujson==1.35
|
ujson==1.35
|
||||||
unittest2==1.1.0
|
unittest2==1.1.0
|
||||||
vine==1.1.4
|
vine==1.1.4
|
||||||
|
|
|
@ -16,6 +16,6 @@ simplejson>=3.5.1 # MIT
|
||||||
six>=1.10.0 # MIT
|
six>=1.10.0 # MIT
|
||||||
osc-lib>=1.8.0 # Apache-2.0
|
osc-lib>=1.8.0 # Apache-2.0
|
||||||
websocket-client>=0.44.0 # LGPLv2+
|
websocket-client>=0.44.0 # LGPLv2+
|
||||||
tripleo-common>=10.7.0 # Apache-2.0
|
tripleo-common>=11.3.1 # Apache-2.0
|
||||||
cryptography>=2.1 # BSD/Apache-2.0
|
cryptography>=2.1 # BSD/Apache-2.0
|
||||||
futures>=3.0.0;python_version=='2.7' or python_version=='2.6' # BSD
|
futures>=3.0.0;python_version=='2.7' or python_version=='2.6' # BSD
|
||||||
|
|
|
@ -782,10 +782,14 @@ class TestTripleoImagePrepare(TestPluginV1):
|
||||||
with open(self.roles_data_file, 'w') as f:
|
with open(self.roles_data_file, 'w') as f:
|
||||||
f.write(self.roles_yaml)
|
f.write(self.roles_yaml)
|
||||||
|
|
||||||
|
@mock.patch('tripleo_common.utils.locks.processlock.'
|
||||||
|
'ProcessLock')
|
||||||
@mock.patch('tripleo_common.image.kolla_builder.'
|
@mock.patch('tripleo_common.image.kolla_builder.'
|
||||||
'container_images_prepare_multi')
|
'container_images_prepare_multi')
|
||||||
def test_tripleo_container_image_prepare(self, prepare_multi):
|
def test_tripleo_container_image_prepare(self, prepare_multi, mock_lock):
|
||||||
|
|
||||||
|
mock_lockobj = mock.MagicMock()
|
||||||
|
mock_lock.return_value = mock_lockobj
|
||||||
env_file = os.path.join(self.temp_dir, 'containers_env.yaml')
|
env_file = os.path.join(self.temp_dir, 'containers_env.yaml')
|
||||||
|
|
||||||
arglist = [
|
arglist = [
|
||||||
|
@ -813,7 +817,8 @@ class TestTripleoImagePrepare(TestPluginV1):
|
||||||
self.default_env,
|
self.default_env,
|
||||||
yaml.safe_load(self.roles_yaml),
|
yaml.safe_load(self.roles_yaml),
|
||||||
dry_run=False,
|
dry_run=False,
|
||||||
cleanup='full')
|
cleanup='full',
|
||||||
|
lock=mock_lockobj)
|
||||||
|
|
||||||
with open(env_file) as f:
|
with open(env_file) as f:
|
||||||
result = yaml.safe_load(f)
|
result = yaml.safe_load(f)
|
||||||
|
|
|
@ -32,6 +32,7 @@ import yaml
|
||||||
from tripleo_common.image.builder import buildah
|
from tripleo_common.image.builder import buildah
|
||||||
from tripleo_common.image import image_uploader
|
from tripleo_common.image import image_uploader
|
||||||
from tripleo_common.image import kolla_builder
|
from tripleo_common.image import kolla_builder
|
||||||
|
from tripleo_common.utils.locks import processlock
|
||||||
|
|
||||||
from tripleoclient import command
|
from tripleoclient import command
|
||||||
from tripleoclient import constants
|
from tripleoclient import constants
|
||||||
|
@ -952,9 +953,10 @@ class TripleOImagePrepare(command.Command):
|
||||||
parsed_args.environment_directories
|
parsed_args.environment_directories
|
||||||
)
|
)
|
||||||
|
|
||||||
|
lock = processlock.ProcessLock()
|
||||||
params = kolla_builder.container_images_prepare_multi(
|
params = kolla_builder.container_images_prepare_multi(
|
||||||
env, roles_data, dry_run=parsed_args.dry_run,
|
env, roles_data, dry_run=parsed_args.dry_run,
|
||||||
cleanup=parsed_args.cleanup)
|
cleanup=parsed_args.cleanup, lock=lock)
|
||||||
env_data = build_env_file(params, self.app.command_options)
|
env_data = build_env_file(params, self.app.command_options)
|
||||||
if parsed_args.output_env_file:
|
if parsed_args.output_env_file:
|
||||||
if os.path.exists(parsed_args.output_env_file):
|
if os.path.exists(parsed_args.output_env_file):
|
||||||
|
|
Loading…
Reference in New Issue