From c83fc5fd4997806d9c74afd4af2f373e15910277 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Sun, 29 Dec 2024 00:19:40 +0100 Subject: [PATCH] slack: deprecate current default `auto` for `prepend_hash` (#9443) Thanks @felixfontein ! --- changelogs/fragments/9443-slack-prepend_hash.yml | 3 +++ plugins/modules/slack.py | 16 ++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/9443-slack-prepend_hash.yml diff --git a/changelogs/fragments/9443-slack-prepend_hash.yml b/changelogs/fragments/9443-slack-prepend_hash.yml new file mode 100644 index 0000000000..98151ba51e --- /dev/null +++ b/changelogs/fragments/9443-slack-prepend_hash.yml @@ -0,0 +1,3 @@ +deprecated_features: + - "slack - the default value ``auto`` of the ``prepend_hash`` option is deprecated and will change to ``never`` in community.general 12.0.0 + (https://github.com/ansible-collections/community.general/pull/9443)." diff --git a/plugins/modules/slack.py b/plugins/modules/slack.py index b4e637f591..40babbc01e 100644 --- a/plugins/modules/slack.py +++ b/plugins/modules/slack.py @@ -134,11 +134,14 @@ options: a small set of the prefixes that should not have a V(#) prepended. Since an exact condition which O(channel) values must not have the V(#) prefix is not known, the value V(auto) for this option will be deprecated in the future. It is best to explicitly set O(prepend_hash=always) or O(prepend_hash=never) to obtain the needed behavior. + - The B(current default) is V(auto), which has been B(deprecated) since community.general 10.2.0. + It will change to V(never) in community.general 12.0.0. + To prevent deprecation warnings you can explicitly set O(prepend_hash) to the value you want. + We suggest to only use V(always) or V(never), but not V(auto), when explicitly setting a value. choices: - 'always' - 'never' - 'auto' - default: 'auto' version_added: 6.1.0 """ @@ -446,7 +449,7 @@ def main(): attachments=dict(type='list', elements='dict'), blocks=dict(type='list', elements='dict'), message_id=dict(type='str'), - prepend_hash=dict(type='str', default='auto', choices=['always', 'never', 'auto']), + prepend_hash=dict(type='str', choices=['always', 'never', 'auto']), ), supports_check_mode=True, ) @@ -467,6 +470,15 @@ def main(): message_id = module.params['message_id'] prepend_hash = module.params['prepend_hash'] + if prepend_hash is None: + module.deprecate( + "The default value 'auto' for 'prepend_hash' is deprecated and will change to 'never' in community.general 12.0.0." + " You can explicitly set 'prepend_hash' in your task to avoid this deprecation warning", + version="12.0.0", + collection_name="community.general", + ) + prepend_hash = 'auto' + color_choices = ['normal', 'good', 'warning', 'danger'] if color not in color_choices and not is_valid_hex_color(color): module.fail_json(msg="Color value specified should be either one of %r "