aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorLoys Ollivier <lollivier@baylibre.com>2017-12-06 14:56:13 +0100
committerLoys Ollivier <lollivier@baylibre.com>2017-12-06 14:56:13 +0100
commit40e9a765eebc5c5754188338b8eb34059a054ebb (patch)
tree6f600959c3daea8a60e3fcc8bc23ee972a2bfbec /utils
parent1d686ceffb79898104b8f2bfd76960f82a3e53b5 (diff)
utils/agljobtemplate.py: Raise an error if jinja version is incorrect
The jinja2 template calls needs a jinja version >= 2.9. Otherwise fails to create a correct output yaml file. Check for the jinja version at runtime. More precisely, check for a specific function that was added in 2.9 and raise an error if it does not exist. Change-Id: Ifd627a25dcfabdd639c53e1b29b891db8bff50c4 Signed-off-by: Loys Ollivier <lollivier@baylibre.com>
Diffstat (limited to 'utils')
-rw-r--r--utils/agljobtemplate.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/utils/agljobtemplate.py b/utils/agljobtemplate.py
index 381f7f4..90bad13 100644
--- a/utils/agljobtemplate.py
+++ b/utils/agljobtemplate.py
@@ -48,6 +48,10 @@ class Agljobtemplate(object):
RFS_TYPE = ['nbd', 'ramdisk']
def __init__(self, path=DEFAULT_PATH):
+ try:
+ from jinja2 import select_autoescape
+ except ImportError:
+ raise ImportError, "Please make sure your version of jinja2 is >= 2.9"
self._template_path = os.path.normpath(path)
if not (os.path.isdir(self._template_path) and os.access(self._template_path, os.F_OK)):
raise OSError, "Cannot access {}".format(self._template_path)