Browse Source

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
changes/70/701570/1
Alex Schultz 5 months ago
parent
commit
9206ff9a85
4 changed files with 12 additions and 5 deletions
  1. +1
    -1
      lower-constraints.txt
  2. +1
    -1
      requirements.txt
  3. +7
    -2
      tripleoclient/tests/v1/test_container_image.py
  4. +3
    -1
      tripleoclient/v1/container_image.py

+ 1
- 1
lower-constraints.txt View File

@@ -147,7 +147,7 @@ testscenarios===0.4
testtools==2.2.0
tooz==1.58.0
traceback2==1.4.0
tripleo-common==10.6.1
tripleo-common==10.8.2
ujson==1.35
unittest2==1.1.0
vine==1.1.4


+ 1
- 1
requirements.txt View File

@@ -16,6 +16,6 @@ simplejson>=3.5.1 # MIT
six>=1.10.0 # MIT
osc-lib>=1.8.0 # Apache-2.0
websocket-client>=0.44.0 # LGPLv2+
tripleo-common>=10.6.1 # Apache-2.0
tripleo-common>=10.8.2 # Apache-2.0
cryptography>=2.1 # BSD/Apache-2.0
futures>=3.0.0;python_version=='2.7' or python_version=='2.6' # BSD

+ 7
- 2
tripleoclient/tests/v1/test_container_image.py View File

@@ -345,10 +345,14 @@ class TestTripleoImagePrepare(TestPluginV1):
with open(self.roles_data_file, 'w') as f:
f.write(self.roles_yaml)

@mock.patch('tripleo_common.utils.locks.processlock.'
'ProcessLock')
@mock.patch('tripleo_common.image.kolla_builder.'
'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')

arglist = [
@@ -376,7 +380,8 @@ class TestTripleoImagePrepare(TestPluginV1):
self.default_env,
yaml.safe_load(self.roles_yaml),
dry_run=False,
cleanup='full')
cleanup='full',
lock=mock_lockobj)

with open(env_file) as f:
result = yaml.safe_load(f)


+ 3
- 1
tripleoclient/v1/container_image.py View File

@@ -31,6 +31,7 @@ import yaml
from tripleo_common.image.builder import buildah
from tripleo_common.image import image_uploader
from tripleo_common.image import kolla_builder
from tripleo_common.utils.locks import processlock

from tripleoclient import command
from tripleoclient import constants
@@ -654,9 +655,10 @@ class TripleOImagePrepare(command.Command):
parsed_args.environment_directories
)

lock = processlock.ProcessLock()
params = kolla_builder.container_images_prepare_multi(
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)
if parsed_args.output_env_file:
if os.path.exists(parsed_args.output_env_file):


Loading…
Cancel
Save