Skip to content

Commit

Permalink
cmd_runner: deprecate fmt as the name for the format class (#4777)
Browse files Browse the repository at this point in the history
* cmd_runner: deprecate fmt as the name for the format class

* added changelog fragment

* fixing the deprecation comment

(cherry picked from commit 2d38c8d)
  • Loading branch information
russoz authored and patchback[bot] committed Jun 6, 2022
1 parent 9f0913b commit eca1c76
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/4777-cmd-runner-deprecate-fmt.yaml
Original file line number Diff line number Diff line change
@@ -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).
10 changes: 9 additions & 1 deletion plugins/module_utils/cmd_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,4 +294,12 @@ def __exit__(self, exc_type, exc_val, exc_tb):
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
2 changes: 1 addition & 1 deletion plugins/module_utils/gconftool2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/targets/cmd_runner/library/cmd_echo.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
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():
Expand Down

0 comments on commit eca1c76

Please sign in to comment.