diff --git a/changelogs/fragments/4777-cmd-runner-deprecate-fmt.yaml b/changelogs/fragments/4777-cmd-runner-deprecate-fmt.yaml new file mode 100644 index 0000000000..6057cf38e8 --- /dev/null +++ b/changelogs/fragments/4777-cmd-runner-deprecate-fmt.yaml @@ -0,0 +1,2 @@ +deprecated_features: + - cmd_runner module utils - deprecated ``fmt`` in favour of ``cmd_runner_fmt`` as the parameter format object (https://github.com/ansible-collections/community.general/pull/4777). diff --git a/plugins/module_utils/cmd_runner.py b/plugins/module_utils/cmd_runner.py index d154dbb7ee..7d6a690224 100644 --- a/plugins/module_utils/cmd_runner.py +++ b/plugins/module_utils/cmd_runner.py @@ -294,4 +294,12 @@ class _CmdRunnerContext(object): return False -fmt = _Format() +cmd_runner_fmt = _Format() + +# +# The fmt form is deprecated and will be removed in community.general 7.0.0 +# Please use: +# cmd_runner_fmt +# Or, to retain the same effect, use: +# from ansible_collections.community.general.plugins.module_utils.cmd_runner import cmd_runner_fmt as fmt +fmt = cmd_runner_fmt diff --git a/plugins/module_utils/gconftool2.py b/plugins/module_utils/gconftool2.py index df9608fb30..f4ee34325d 100644 --- a/plugins/module_utils/gconftool2.py +++ b/plugins/module_utils/gconftool2.py @@ -5,7 +5,7 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -from ansible_collections.community.general.plugins.module_utils.cmd_runner import CmdRunner, fmt +from ansible_collections.community.general.plugins.module_utils.cmd_runner import CmdRunner, cmd_runner_fmt as fmt def gconftool2_runner(module, **kwargs): diff --git a/tests/integration/targets/cmd_runner/library/cmd_echo.py b/tests/integration/targets/cmd_runner/library/cmd_echo.py index 4b9cb8b547..4fd32a7ac6 100644 --- a/tests/integration/targets/cmd_runner/library/cmd_echo.py +++ b/tests/integration/targets/cmd_runner/library/cmd_echo.py @@ -14,7 +14,7 @@ EXAMPLES = "" RETURN = "" from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.general.plugins.module_utils.cmd_runner import CmdRunner, fmt +from ansible_collections.community.general.plugins.module_utils.cmd_runner import CmdRunner, cmd_runner_fmt as fmt def main():