Skip to content
Snippets Groups Projects
Commit 2b00ba41 authored by rthallisey's avatar rthallisey
Browse files

Fail faster when docker isn't running

In order to make build.py more friendly, have it fail faster
when the script is unable to connect to Docker because it's not
running.

Change-Id: I6d480e601ea2511df9396fcf4e89c06c06d4c21c
Closes-Bug: #1488133
parent eb05118a
No related branches found
No related tags found
No related merge requests found
......@@ -32,6 +32,7 @@ import time
import docker
import jinja2
from requests.exceptions import ConnectionError
logging.basicConfig()
LOG = logging.getLogger(__name__)
......@@ -68,6 +69,13 @@ class WorkerThread(Thread):
self.queue.task_done()
except Queue.Empty:
break
except ConnectionError as e:
LOG.error(e)
LOG.error('Make sure Docker is running and that you have '
'the correct privileges to run Docker (root)')
data['status'] = "connection_error"
self.queue.task_done()
break
def process_source(self, source, dest_dir):
if source.get('type') == 'url':
......@@ -89,7 +97,10 @@ class WorkerThread(Thread):
image['status'] = "building"
if image['parent'] is not None and \
image['parent']['status'] in ['error', 'parent_error']:
image['parent']['status'] in ['error', 'parent_error',
'connection_error']:
LOG.error('Parent image error\'d with message "%s"',
image['parent']['status'])
image['status'] = "parent_error"
return
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment