Fix config_template to work with Ansible 2.6
In Ansible 2.6 the copy module now recognizes the "_original_basename" option and not the "original_basename" option. In order for this module to work with versions less than 2.6.0 and 2.6.0+ we need to allow an if statement based on the version of Ansible being used. Change-Id: I3f7a12dec77ea6e8e3c9fcae6ce9c162df57e50c
This commit is contained in:
parent
df1875aa8f
commit
fcf669b78c
|
@ -39,6 +39,8 @@ from ansible.module_utils._text import to_bytes, to_text
|
|||
from ansible import constants as C
|
||||
from ansible import errors
|
||||
from ansible.parsing.yaml.dumper import AnsibleDumper
|
||||
from distutils.version import LooseVersion
|
||||
from ansible import __version__ as __ansible_version__
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
|
@ -654,14 +656,24 @@ class ActionModule(ActionBase):
|
|||
self._connection._shell.join_path(tmp, 'source'),
|
||||
resultant
|
||||
)
|
||||
new_module_args.update(
|
||||
dict(
|
||||
src=transferred_data,
|
||||
dest=_vars['dest'],
|
||||
original_basename=os.path.basename(source),
|
||||
follow=True,
|
||||
),
|
||||
)
|
||||
if LooseVersion(__ansible_version__) < LooseVersion("2.6"):
|
||||
new_module_args.update(
|
||||
dict(
|
||||
src=transferred_data,
|
||||
dest=_vars['dest'],
|
||||
original_basename=os.path.basename(source),
|
||||
follow=True,
|
||||
),
|
||||
)
|
||||
else:
|
||||
new_module_args.update(
|
||||
dict(
|
||||
src=transferred_data,
|
||||
dest=_vars['dest'],
|
||||
_original_basename=os.path.basename(source),
|
||||
follow=True,
|
||||
),
|
||||
)
|
||||
|
||||
# Remove data types that are not available to the copy module
|
||||
new_module_args.pop('config_overrides', None)
|
||||
|
|
Loading…
Reference in New Issue