Merge "Raise if parsing, rendering, or writing fails"

This commit is contained in:
Zuul 2017-10-23 16:59:20 +00:00 committed by Gerrit Code Review
commit 039a8c050e

View File

@ -67,7 +67,7 @@ def main():
environment = jinja2.Environment(loader=loader) environment = jinja2.Environment(loader=loader)
except Exception as e: except Exception as e:
logger.error("initialising template environment failed: %s" % e) logger.error("initialising template environment failed: %s" % e)
return 1 raise
try: try:
service_types = os_service_types.ServiceTypes( service_types = os_service_types.ServiceTypes(
@ -88,7 +88,7 @@ def main():
except Exception as e: except Exception as e:
logger.error("parsing template %s failed: %s" % logger.error("parsing template %s failed: %s" %
(templateFile, e)) (templateFile, e))
continue raise
try: try:
@ -101,7 +101,7 @@ def main():
except Exception as e: except Exception as e:
logger.error("rendering template %s failed: %s" % logger.error("rendering template %s failed: %s" %
(templateFile, e)) (templateFile, e))
continue raise
try: try:
target_directory = os.path.join(args.output_directory, target_directory = os.path.join(args.output_directory,
@ -116,7 +116,7 @@ def main():
fh.write(output.encode('utf8')) fh.write(output.encode('utf8'))
except (IOError, OSError, UnicodeEncodeError) as e: except (IOError, OSError, UnicodeEncodeError) as e:
logger.error("writing %s failed: %s" % (target_file, e)) logger.error("writing %s failed: %s" % (target_file, e))
continue raise
return 0 return 0