cloud-init-dev team mailing list archive
-
cloud-init-dev team
-
Mailing list archive
-
Message #05563
[Merge] ~smoser/cloud-init:fix/cent-6-jinja2 into cloud-init:master
Scott Moser has proposed merging ~smoser/cloud-init:fix/cent-6-jinja2 into cloud-init:master.
Commit message:
Centos 6: Fix jinja rendering on older jinja versions.
jinja2.runtime.implements_to_string is not available in older versions
of jinja2. This just catches that error separately from other
jinja support allowing the code to work.
The testcase to recreate was:
./tools/run-container --source-package --package \
--artifacts=./rpm/ centos/6
Requested reviews:
cloud-init commiters (cloud-init-dev)
For more details, see:
https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/356079
see commit message
--
Your team cloud-init commiters is requested to review the proposed merge of ~smoser/cloud-init:fix/cent-6-jinja2 into cloud-init:master.
diff --git a/cloudinit/templater.py b/cloudinit/templater.py
index b668674..f1034aa 100644
--- a/cloudinit/templater.py
+++ b/cloudinit/templater.py
@@ -21,16 +21,19 @@ except (ImportError, AttributeError):
CHEETAH_AVAILABLE = False
try:
- from jinja2.runtime import implements_to_string
from jinja2 import Template as JTemplate
from jinja2 import DebugUndefined as JUndefined
JINJA_AVAILABLE = True
except (ImportError, AttributeError):
- from cloudinit.helpers import identity
- implements_to_string = identity
JINJA_AVAILABLE = False
JUndefined = object
+try:
+ from jinja2.runtime import implements_to_string
+except (ImportError, AttributeError):
+ from cloudinit.helpers import identity
+ implements_to_string = identity
+
from cloudinit import log as logging
from cloudinit import type_utils as tu
from cloudinit import util
Follow ups