Browse Source

Make code compatible with older ansible versions

Change-Id: I42b04b5a70aeba0eba0ca9444079cddc0a95e2ae
changes/12/736512/1
Dmitriy Rabotyagov 3 weeks ago
parent
commit
4e6d993457
1 changed files with 12 additions and 1 deletions
  1. +12
    -1
      action/config_template.py

+ 12
- 1
action/config_template.py View File

@@ -865,9 +865,20 @@ class ActionModule(ActionBase):
).decode('utf-8')

self._templar.environment.loader.searchpath = _vars['searchpath']
self._templar.available_variables = temp_vars

if LooseVersion(__ansible_version__) < LooseVersion("2.9"):
self._templar.set_available_variables(temp_vars)
else:
self._templar.available_variables = temp_vars

resultant = self._check_templar(data=template_data)

if LooseVersion(__ansible_version__) < LooseVersion("2.9"):
# Access to protected method is unavoidable in Ansible
self._templar.set_available_variables(
self._templar._available_variables
)

type_merger = getattr(self, CONFIG_TYPES.get(_vars['config_type']))
resultant, config_base = type_merger(
config_overrides=_vars['config_overrides'],


Loading…
Cancel
Save