build with --template-only to not require running docker service

Add a try/except check and raise excpetion if not --template-only

Reason for this is so that you can run kolla_build --template-only
on a system with a user that doesn't have permissions to access
docker or system may not have docker service running.  The template
only generation is ok because it doesn't specifically need the docker
context

Change-Id: I191f3e073d14e9ba5419a8a9b043e8afaa565e2a
This commit is contained in:
Jon Schlueter 2018-07-26 12:56:54 -04:00
parent 2aefc3d8fa
commit 9cc7667a51
1 changed files with 6 additions and 1 deletions

View File

@ -710,7 +710,12 @@ class KollaWorker(object):
self.maintainer = conf.maintainer
docker_kwargs = docker.utils.kwargs_from_env()
self.dc = docker.APIClient(version='auto', **docker_kwargs)
try:
self.dc = docker.APIClient(version='auto', **docker_kwargs)
except docker.errors.DockerException as e:
self.dc = None
if not conf.template_only:
raise e
def _get_images_dir(self):
possible_paths = (