Loading custom jinja2 filters use system python instead of ansible_python_interpreter in 1.6.2

Hi,

I just upgraded Ansible from 1.4 → 1.6.2 and noticed that one of our custom jinja 2 plugins configured in filter_plugins/custom_plugins.py no longer works since a used module is not in the system python. The plugin provided a vault functionality because at that time it was not available in Ansible yet. The code:

filter_plugins/custom_plugins.py

import os.path
from ansible import errors

try:

from keyczar import keyczar

def vault(encrypted):
keydir = os.path.expanduser(‘~/.mykeystore’)
crypter = keyczar.Crypter.Read(keydir)
return crypter.Decrypt(encrypted)

except ImportError as e:
raise errors.AnsibleFilterError(“|keyczar not loaded: %s” % e)

We could use it in tasks like this:

Ansible’s core code has never used ansible_python_interpreter for filter plugins, actually. They run under the process that launched ansible, not remotely, so this doesn’t really apply.

So you’ll have to make things installed where your current python you are executing ansible with can find it.

I suspect you might have tweaked the ansible shebang line on your copy, and the upgrade (correctly) put it back, and you might want to change it again or something?