From ef07f9b9ff8de459429fd3e22aa27b406624a804 Mon Sep 17 00:00:00 2001 From: Frank Dornheim <524257+conloos@users.noreply.github.com> Date: Tue, 28 Sep 2021 07:07:55 +0200 Subject: [PATCH] Enable deprecaded message for ignore_volatile_options (#3429) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * enable deprecate message for ignore_volatile_options * fix E128 * add frament 3429 * remove default value and modify the resulting checks spelling fixes bump version for deprecated messge * fix spelling and depricated version Co-authored-by: Frank Dornheim <“dornheim@posteo.de@users.noreply.github.com”> --- ...ded_message_for_ignore_volatile_option.yml | 2 ++ plugins/modules/cloud/lxd/lxd_container.py | 23 ++++++++++--------- 2 files changed, 14 insertions(+), 11 deletions(-) create mode 100644 changelogs/fragments/3429-enable_deprecaded_message_for_ignore_volatile_option.yml diff --git a/changelogs/fragments/3429-enable_deprecaded_message_for_ignore_volatile_option.yml b/changelogs/fragments/3429-enable_deprecaded_message_for_ignore_volatile_option.yml new file mode 100644 index 0000000000..ce7a56cb10 --- /dev/null +++ b/changelogs/fragments/3429-enable_deprecaded_message_for_ignore_volatile_option.yml @@ -0,0 +1,2 @@ +deprecated_features: + - "lxd_container - the current default value ``true`` of ``ignore_volatile_options`` is deprecated and will change to ``false`` in community.general 6.0.0 (https://github.com/ansible-collections/community.general/pull/3429)." diff --git a/plugins/modules/cloud/lxd/lxd_container.py b/plugins/modules/cloud/lxd/lxd_container.py index 16eea8f44c..6bc71fc757 100644 --- a/plugins/modules/cloud/lxd/lxd_container.py +++ b/plugins/modules/cloud/lxd/lxd_container.py @@ -43,10 +43,9 @@ options: - If set to C(true), options starting with C(volatile.) are ignored. As a result, they are reapplied for each execution. - This default behavior can be changed by setting this option to C(false). - - The default value C(true) will be deprecated in community.general 4.0.0, - and will change to C(false) in community.general 5.0.0. + - The current default value C(true) is deprecated since community.general 4.0.0, + and will change to C(false) in community.general 6.0.0. type: bool - default: true required: false version_added: 3.7.0 profiles: @@ -674,7 +673,6 @@ def main(): ), ignore_volatile_options=dict( type='bool', - default=True ), devices=dict( type='dict', @@ -728,13 +726,16 @@ def main(): ), supports_check_mode=False, ) - # if module.params['ignore_volatile_options'] is None: - # module.params['ignore_volatile_options'] = True - # module.deprecate( - # 'If the keyword "volatile" is used in a playbook in the config section, a - # "changed" message will appear with every run, even without a change to the playbook. - # This will change in the future. - # Please test your scripts by "ignore_volatile_options: false"', version='5.0.0', collection_name='community.general') + + if module.params['ignore_volatile_options'] is None: + module.params['ignore_volatile_options'] = True + module.deprecate( + 'If the keyword "volatile" is used in a playbook in the config' + 'section, a "changed" message will appear with every run, even without a change' + 'to the playbook.' + 'This will change in the future. Please test your scripts' + 'by "ignore_volatile_options: false". To keep the old behavior, set that option explicitly to "true"', + version='6.0.0', collection_name='community.general') lxd_manage = LXDContainerManagement(module=module) lxd_manage.run()