aboutsummaryrefslogtreecommitdiff
path: root/kolla
diff options
context:
space:
mode:
authorMarcin Juszkiewicz <marcin.juszkiewicz@linaro.org>2019-03-13 15:45:22 +0100
committerMarcin Juszkiewicz <marcin.juszkiewicz@linaro.org>2019-03-26 10:08:46 +0100
commita21ab86ca6e38a9b90a6c40f2aab87030e6f010f (patch)
tree702a8789bdab01704e16899e001f82d638e08906 /kolla
parent7d8eafaee84bad04bade68a7a580ed9c1a2413fc (diff)
downloadkolla-a21ab86ca6e38a9b90a6c40f2aab87030e6f010f.tar.gz
kolla-a21ab86ca6e38a9b90a6c40f2aab87030e6f010f.zip
build: handle template syntax errors better
Before: (venv-for-kolla) 15:35 (s) hrw@puchatek:kolla$ ./tools/build.py --template-only INFO:kolla.common.utils:Found the docker image folder at /home/hrw/devel/linaro/kolla/docker Traceback (most recent call last): [.. here goes 100 lines of Jinja2 traceback ..] jinja2.exceptions.TemplateSyntaxError: unexpected '}', expected ']' After: (venv-for-kolla) 15:44 (s) hrw@puchatek:kolla$ ./tools/build.py --template-only INFO:kolla.common.utils:Found the docker image folder at /home/hrw/devel/linaro/kolla/docker ERROR:kolla.common.utils:Syntax error in template: ironic-inspector/Dockerfile.j2 ERROR:kolla.common.utils:unexpected '}', expected ']' INFO:kolla.common.utils:Dockerfiles are generated in /tmp/kolla-2019-03-13_15-44-28_0ovk4xu_/docker Change-Id: Iaa899f0b81f6698aa86b15977c39af3269d31e9a
Diffstat (limited to 'kolla')
-rwxr-xr-xkolla/cmd/build.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/kolla/cmd/build.py b/kolla/cmd/build.py
index 25facd19d..e912a6d12 100755
--- a/kolla/cmd/build.py
+++ b/kolla/cmd/build.py
@@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import jinja2
import os
import sys
@@ -28,13 +29,18 @@ from kolla.image import build # noqa
def main():
- statuses = build.run_build()
- if statuses:
- (bad_results, good_results, unmatched_results,
- skipped_results) = statuses
- if bad_results:
- return 1
- return 0
+ try:
+ statuses = build.run_build()
+ if statuses:
+ (bad_results, good_results, unmatched_results,
+ skipped_results) = statuses
+ if bad_results:
+ return 1
+ return 0
+ except jinja2.exceptions.TemplateSyntaxError as e:
+ build.LOG.error("Syntax error in template: %s" % e.name)
+ build.LOG.error(e.message)
+ return 1
if __name__ == '__main__':