diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2015-09-11 09:43:04 -0500 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2015-09-11 09:43:04 -0500 |
commit | 31a5ce757295e841e72e0149c5851ceace976b44 (patch) | |
tree | 5573bc8b6ae6741753090c4495bb0ed7e8fdad95 /src/lib/Bcfg2/Server | |
parent | 315d96e6bff85a319d3c3ec2d76da7487fa097e9 (diff) | |
parent | 8c6e55b967c78d09328f3081ababe2db0610c3eb (diff) | |
download | bcfg2-31a5ce757295e841e72e0149c5851ceace976b44.tar.gz bcfg2-31a5ce757295e841e72e0149c5851ceace976b44.tar.bz2 bcfg2-31a5ce757295e841e72e0149c5851ceace976b44.zip |
Merge pull request #306 from gordonmessmer/master
Keep trailing newlines in Jinja2 templates.
Diffstat (limited to 'src/lib/Bcfg2/Server')
-rw-r--r-- | src/lib/Bcfg2/Server/Plugins/Cfg/CfgJinja2Generator.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/Cfg/CfgJinja2Generator.py b/src/lib/Bcfg2/Server/Plugins/Cfg/CfgJinja2Generator.py index e4df9e09d..71aec7658 100644 --- a/src/lib/Bcfg2/Server/Plugins/Cfg/CfgJinja2Generator.py +++ b/src/lib/Bcfg2/Server/Plugins/Cfg/CfgJinja2Generator.py @@ -69,7 +69,15 @@ class CfgJinja2Generator(CfgGenerator): encoding = Bcfg2.Options.setup.encoding self.loader = self.__loader_cls__('/', encoding=encoding) - self.environment = self.__environment_cls__(loader=self.loader) + try: + # keep_trailing_newline is new in Jinja2 2.7, and will + # fail with earlier versions + self.environment = \ + self.__environment_cls__(loader=self.loader, + keep_trailing_newline=True) + except TypeError: + self.environment = \ + self.__environment_cls__(loader=self.loader) __init__.__doc__ = CfgGenerator.__init__.__doc__ def get_data(self, entry, metadata): |