Emit an error for a missing E-mail template

Instead of silently doing nothing when asked to render a message for
an event with no available template, return nonzero and provide an
explanation.

Change-Id: I8b86ad1d90f8e83f0d37cade73a94be041b07ae7
This commit is contained in:
Jeremy Stanley 2019-08-22 19:18:21 +00:00
parent 27bd00e0a4
commit 6ef4f4bc8f
1 changed files with 3 additions and 1 deletions

View File

@ -4,6 +4,7 @@ from __future__ import unicode_literals
import argparse
import jinja2
import os
import sys
from openstack_election.cmds import render_statistics as stats
from openstack_election import config
@ -82,6 +83,7 @@ def main():
template = env.get_template('%s.j2' % func_name)
print(template.render(fmt_args))
except jinja2.exceptions.TemplateNotFound:
pass
print('\nNo %s.j2 template found.\n' % func_name, file=sys.stderr)
return 1
return 0