charmhelpers/core/templating.py only imports python-jinja2, useless when using python3

Bug #1603188 reported by Francis Ginther
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Charm Helpers
Fix Released
Undecided
Francis Ginther

Bug Description

This code in charmhelpers/core/templating.py will install 'python-jinja2' if it's not otherwise installed:

def render(source, target, context, owner='root', group='root',
           perms=0o444, templates_dir=None, encoding='UTF-8', template_loader=None):
    """..."""
    try:
        from jinja2 import FileSystemLoader, Environment, exceptions
    except ImportError:
        try:
            from charmhelpers.fetch import apt_install
        except ImportError:
            hookenv.log('Could not import jinja2, and could not import '
                        'charmhelpers.fetch to install it',
                        level=hookenv.ERROR)
            raise
        apt_install('python-jinja2', fatal=True)
        from jinja2 import FileSystemLoader, Environment, exceptions

However, when run as part of a python3 hook, it needs to import 'python3-jinja2' instead.

Tags: landscape

Related branches

tags: removed: kanban-cross-team
Stuart Bishop (stub)
Changed in charm-helpers:
assignee: nobody → Francis Ginther (fginther)
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.