Skip to content

Commit

Permalink
CmdRunner module utils: deprecate format method as_default_type() (#…
Browse files Browse the repository at this point in the history
…6601)

* CmdRunner module utils: deprecate format method `as_default_type()`

* add changelog frag
  • Loading branch information
russoz authored May 31, 2023
1 parent 47f3967 commit c9aae5e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
deprecated_features:
- CmdRunner module utils - deprecate ``cmd_runner_fmt.as_default_type()`` formatter (https://github.com/ansible-collections/community.general/pull/6601).
5 changes: 5 additions & 0 deletions plugins/module_utils/cmd_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ def as_map(_map, default=None, ignore_none=None):

@staticmethod
def as_default_type(_type, arg="", ignore_none=None):
#
# DEPRECATION: This method is deprecated and will be removed in community.general 10.0.0
#
# Instead of using the implicit formats provided here, use the explicit necessary format method.
#
fmt = _Format
if _type == "dict":
return fmt.as_func(lambda d: ["--{0}={1}".format(*a) for a in iteritems(d)], ignore_none=ignore_none)
Expand Down

0 comments on commit c9aae5e

Please sign in to comment.