1
0
mirror of https://github.com/openshift/source-to-image.git synced 2026-02-05 12:44:54 +01:00

Add error handling when wharfie build fails

This commit is contained in:
Paul Morie
2014-01-29 17:34:47 -05:00
parent 94addef9e8
commit f675e3433b
2 changed files with 10 additions and 3 deletions

View File

@@ -1,3 +1,4 @@
pbr>=0.5.21,<1.0
docopt>=0.6.1
docker-py>=0.2.3
colorama>=0.2.5

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env python
from colorama import *
import os
import sys
import docopt
@@ -124,10 +125,15 @@ class Builder(object):
print("Building new docker image")
img, logs = self.docker_client.build(tag=tag, path=tmp_dir, rm=True)
print("Build logs: %s" % logs)
if tag:
print("Built image %s" % tag)
if img is not None:
if tag:
print("Built image %s" % tag)
else:
print("Built image %s" % img)
else:
print("Built image %s" % img)
print(Fore.RED + "Wharfie build failed.")
finally:
shutil.rmtree(tmp_dir)