[cobbler] Can 'Template Files' be in jinja2?

James Cammarata jimi at sngx.net
Mon Nov 19 18:46:13 UTC 2012


On Nov 19, 2012 12:15 PM, "Zack Perry" <zack.perry at sbcglobal.net> wrote:
>
> cobbler: 2.4.0 from epel-testing
> server: SL 6.3 64bit
> target: Ubuntu 12.04.1 LTS server
>
> Out of curiosity, I tried to use the jinja2 for a template file in
> /srv/cobbler/sources.j2 as follows:
>
> #template=jinja2
> #
>
> # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
> # newer versions of the distribution.
> deb http://us.archive.ubuntu.com/ubuntu/ {{ os_version }} main restricted
> deb-src http://us.archive.ubuntu.com/ubuntu/ {{ os_version }} main
restricted
> [...]
>
> In the system object, I have:
>
> Template Files                 : {'/srv/cobbler/sources.j2':
'/etc/apt/sources.list'}
>
> The intention is to replace all lines in the /etc/apt/sources.list
> that have the local repo URL with the official ones. Note, this
> is done just for experiment.  At work, we always use our own repo
> mirror.
>
> But, even with python-jinja2 installed on the cobbler server,
> I have been getting the following in the installed services.list:
>
> # ERROR: JINJA2 NOT AVAILABLE. Maybe you need to install python-jinja2?
>
> But, as evident from below, the cobbler host has it!
>
> [root at cobbler ~]# rpm -qi python-jinja2
> Name        : python-jinja2                Relocations: (not relocatable)
> Version     : 2.2.1                             Vendor: Dag Apt
Repository, http://dag.wieers.com/apt/
> Release     : 1.el6.rf                      Build Date: Fri 23 Mar 2012
05:33:19 AM PDT
> Install Date: Mon 19 Nov 2012 09:34:01 AM PST      Build Host:
lisse.hasselt.wieers.com
> Group       : Development/Languages         Source RPM:
python-jinja2-2.2.1-1.el6.rf.src.rpm
> Size        : 2379618                          License: BSD
> Signature   : DSA/SHA1, Tue 03 Apr 2012 06:26:16 AM PDT, Key ID
a20e52146b8d79e6
> Packager    : Dag Wieers <dag at wieers.com>
> URL         : http://jinja.pocoo.org/
> Summary     : General purpose template engine
> Description :
> Jinja2 is a template engine written in pure Python.  It provides a
> Django inspired non-XML syntax but supports inline expressions and an
> optional sandboxed environment.
>
> If you have any exposure to other text-based template languages, such
> as Smarty or Django, you should feel right at home with Jinja2. It's
> both designer and developer friendly by sticking to Python's
> principles and adding functionality useful for templating
> environments.
>
> Is it true that the jinja2 support is only available to snippets?
> That's my impression from reading /etc/cobbler/settings so far.
>
> Regards,
>
> -- Zack

Have you bounced cobblerd since installing jinja2? Its presence is only
checked for when the daemon starts.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.fedorahosted.org/pipermail/cobbler/attachments/20121119/f4044041/attachment.html>


More information about the cobbler mailing list