diff --git a/changelogs/fragments/6601-cmdrunner-deprecate-default-type.yml b/changelogs/fragments/6601-cmdrunner-deprecate-default-type.yml new file mode 100644 index 0000000000..5bb10dbc29 --- /dev/null +++ b/changelogs/fragments/6601-cmdrunner-deprecate-default-type.yml @@ -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). diff --git a/plugins/module_utils/cmd_runner.py b/plugins/module_utils/cmd_runner.py index fa4c555d19..846f76f9e3 100644 --- a/plugins/module_utils/cmd_runner.py +++ b/plugins/module_utils/cmd_runner.py @@ -147,6 +147,11 @@ class _Format(object): @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)