1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

[PR #6601/c9aae5e4 backport][stable-7] CmdRunner module utils: deprecate format method as_default_type() (#6609)

CmdRunner module utils: deprecate format method `as_default_type()` (#6601)

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

* add changelog frag

(cherry picked from commit c9aae5e45c)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2023-05-31 08:33:03 +02:00 committed by GitHub
parent 7ee0389c98
commit 41b5464942
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View file

@ -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).

View file

@ -147,6 +147,11 @@ class _Format(object):
@staticmethod @staticmethod
def as_default_type(_type, arg="", ignore_none=None): 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 fmt = _Format
if _type == "dict": if _type == "dict":
return fmt.as_func(lambda d: ["--{0}={1}".format(*a) for a in iteritems(d)], ignore_none=ignore_none) return fmt.as_func(lambda d: ["--{0}={1}".format(*a) for a in iteritems(d)], ignore_none=ignore_none)