Building a templating renderer

Building a renderer that handles templating files is not that different from one that does serialization. In fact, the renderer itself is pretty much the same, outside of the library-specific code. This time, we'll use a Python library called tenjin. You may need to install it using pip:

# pip install tenjin

Templating with Tenjin

This module makes use of a third-party library, so there will be a __virtual__() function to make sure it's installed:

''' Conver a file using the Tenjin templating engine This file should be saved as salt/renderers/tenjin.py ''' from __future__ import absolute_import try: import tenjin from tenjin.helpers import * HAS_LIBS = True except ImportError: HAS_LIBS = False from salt.ext.six import ...

Get Extending SaltStack now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.