Nelfo
Nelfo

Reputation: 3835

How to add a custom filter to Jinja2 and bundle in Sceptre project?

I would like to add a filter like the Ansible ipaddr filter to a Cloudreach Sceptre project with Jinja2 templates. I'm not proficient with Python but I've seen the Jinja2 documentation on adding custom filters, but this does not demystify for me how to add one so that it can be used in a Sceptre project, and bundled with it.

If I would like to add custom filters to my Sceptre project that can be packaged with my templates (in the local project directory) and hook into the Jinja2 environment.filters[] registration process through Sceptre, how might I go about it? Assume a sceptre project structure as follows:

sceptre_project/
    config/
    filters/
        custom_filter.py
    templates/

Upvotes: 3

Views: 207

Answers (0)

Related Questions