Adapt to_unicode and to_bytes for ansible 2.2

The config_template is using the old ansible objects, this should
make it work with the newest standards.

Change-Id: I9159be497c201ca6c2f558336843be5175f0ee2c
Closes-Bug: 1640458
This commit is contained in:
Jean-Philippe Evrard 2016-11-09 11:58:06 +00:00
parent 4e20bc0e6f
commit 5bf7a5c3f1
1 changed files with 2 additions and 2 deletions

View File

@ -34,7 +34,7 @@ import yaml
from ansible.plugins.action import ActionBase
from ansible.utils.unicode import to_bytes, to_unicode
from ansible.module_utils._text import to_bytes, to_text
from ansible import constants as C
from ansible import errors
@ -510,7 +510,7 @@ class ActionModule(ActionBase):
temp_vars['template_run_date'] = datetime.datetime.now()
with open(source, 'r') as f:
template_data = to_unicode(f.read())
template_data = to_text(f.read())
self._templar.environment.loader.searchpath = _vars['searchpath']
self._templar.set_available_variables(temp_vars)