diff options
| author | Zuul <zuul@review.opendev.org> | 2023-02-27 12:57:29 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2023-02-27 12:57:29 +0000 |
| commit | 35088cf281da2c883b1444fa6cc76013ceba5eac (patch) | |
| tree | f68d07836c442d439cf6bec5c6b16d1d37351c3d /kolla/image/build.py | |
| parent | a627713720e1393a5296d9918fec4d9796a9b16f (diff) | |
| parent | a2854da1b3e12987f7fa7590fca3bb74ac19c53e (diff) | |
| download | kolla-35088cf281da2c883b1444fa6cc76013ceba5eac.tar.gz kolla-35088cf281da2c883b1444fa6cc76013ceba5eac.zip | |
Merge "Add a way to add other container engines"
Diffstat (limited to 'kolla/image/build.py')
| -rw-r--r-- | kolla/image/build.py | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/kolla/image/build.py b/kolla/image/build.py index 7306e5fdc..fdf1635c8 100644 --- a/kolla/image/build.py +++ b/kolla/image/build.py @@ -21,6 +21,7 @@ import time from kolla.common import config as common_config from kolla.common import utils +from kolla.engine_adapter import engine from kolla.image.kolla_worker import KollaWorker from kolla.image.utils import LOG from kolla.image.utils import Status @@ -104,10 +105,28 @@ def run_build(): if conf.debug: LOG.setLevel(logging.DEBUG) - if conf.squash: - squash_version = utils.get_docker_squash_version() - LOG.info('Image squash is enabled and "docker-squash" version is %s', - squash_version) + if conf.engine not in (engine.Engine.DOCKER.value,): + LOG.error(f'Unsupported engine name "{conf.engine}", exiting.') + sys.exit(1) + LOG.info(f'Using engine: {conf.engine}') + + if conf.engine == engine.Engine.DOCKER.value: + try: + import docker + docker.version + except ImportError: + LOG.error("Error, you have set Docker as container engine, " + "but the Python library is not found." + "Try running 'pip install docker'") + sys.exit(1) + except AttributeError: + LOG.error("Error, Docker Python library is too old, " + "Try running 'pip install docker --upgrade'") + + if conf.squash: + squash_version = utils.get_docker_squash_version() + LOG.info('Image squash is enabled and "docker-squash" version ' + 'is %s', squash_version) kolla = KollaWorker(conf) kolla.setup_working_dir() @@ -133,7 +152,7 @@ def run_build(): if conf.save_dependency: kolla.save_dependency(conf.save_dependency) - LOG.info('Docker images dependency are saved in %s', + LOG.info('Container images dependency are saved in %s', conf.save_dependency) return if conf.list_images: |
