From eae7161bf014690cf1eb6c265038eecfbdfa1d20 Mon Sep 17 00:00:00 2001 From: TSKushal <44438079+TSKushal@users.noreply.github.com> Date: Fri, 29 Sep 2023 00:35:12 +0530 Subject: [PATCH] Adding deprecation for timeout parameter from 10 to 60 for redfish_info, redfish_config and redfish_command (#7295) * Adding deprecation for timeout from 10 to 60 for redfish_info, redfish_config and redfish_command * Adding changelog fragment and sanity fixes * Update changelogs/fragments/7295-adding_deprecation_for_timeout_in_redfish_info_config_command.yml Agreed. Thanks! Co-authored-by: Felix Fontein * Update changelogs/fragments/7295-adding_deprecation_for_timeout_in_redfish_info_config_command.yml Agreed. Thanks! Co-authored-by: Felix Fontein * Update plugins/modules/redfish_command.py Agreed. Thanks! Co-authored-by: Felix Fontein * Update plugins/modules/redfish_command.py Agreed. Thanks! Co-authored-by: Felix Fontein * Updating release version --------- Co-authored-by: Kushal Co-authored-by: Felix Fontein --- ...for_timeout_in_redfish_info_config_command.yml | 2 ++ plugins/modules/redfish_command.py | 15 +++++++++++++-- plugins/modules/redfish_config.py | 15 +++++++++++++-- plugins/modules/redfish_info.py | 15 +++++++++++++-- 4 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 changelogs/fragments/7295-adding_deprecation_for_timeout_in_redfish_info_config_command.yml diff --git a/changelogs/fragments/7295-adding_deprecation_for_timeout_in_redfish_info_config_command.yml b/changelogs/fragments/7295-adding_deprecation_for_timeout_in_redfish_info_config_command.yml new file mode 100644 index 0000000000..8e7ce7c186 --- /dev/null +++ b/changelogs/fragments/7295-adding_deprecation_for_timeout_in_redfish_info_config_command.yml @@ -0,0 +1,2 @@ +deprecated_features: + - redfish_info, redfish_config, redfish_command - the default value ``10`` for the ``timeout`` option is deprecated and will change to ``60`` in community.general 9.0.0 (https://github.com/ansible-collections/community.general/pull/7295). diff --git a/plugins/modules/redfish_command.py b/plugins/modules/redfish_command.py index c908e9049a..908eb95c87 100644 --- a/plugins/modules/redfish_command.py +++ b/plugins/modules/redfish_command.py @@ -109,7 +109,8 @@ options: timeout: description: - Timeout in seconds for HTTP requests to OOB controller. - default: 10 + - The default value for this param is C(10) but that is being deprecated + and it will be replaced with C(60) in community.general 9.0.0. type: int boot_override_mode: description: @@ -782,7 +783,7 @@ def main(): update_username=dict(type='str', aliases=["account_updatename"]), account_properties=dict(type='dict', default={}), bootdevice=dict(), - timeout=dict(type='int', default=10), + timeout=dict(type='int'), uefi_target=dict(), boot_next=dict(), boot_override_mode=dict(choices=['Legacy', 'UEFI']), @@ -829,6 +830,16 @@ def main(): supports_check_mode=False ) + if module.params['timeout'] is None: + timeout = 10 + module.deprecate( + 'The default value {0} for parameter param1 is being deprecated and it will be replaced by {1}'.format( + 10, 60 + ), + version='9.0.0', + collection_name='community.general' + ) + category = module.params['category'] command_list = module.params['command'] diff --git a/plugins/modules/redfish_config.py b/plugins/modules/redfish_config.py index 65d933bdbd..1ccc543bc1 100644 --- a/plugins/modules/redfish_config.py +++ b/plugins/modules/redfish_config.py @@ -64,7 +64,8 @@ options: timeout: description: - Timeout in seconds for HTTP requests to OOB controller. - default: 10 + - The default value for this param is C(10) but that is being deprecated + and it will be replaced with C(60) in community.general 9.0.0. type: int boot_order: required: false @@ -347,7 +348,7 @@ def main(): password=dict(no_log=True), auth_token=dict(no_log=True), bios_attributes=dict(type='dict', default={}), - timeout=dict(type='int', default=10), + timeout=dict(type='int'), boot_order=dict(type='list', elements='str', default=[]), network_protocols=dict( type='dict', @@ -379,6 +380,16 @@ def main(): supports_check_mode=False ) + if module.params['timeout'] is None: + timeout = 10 + module.deprecate( + 'The default value {0} for parameter param1 is being deprecated and it will be replaced by {1}'.format( + 10, 60 + ), + version='9.0.0', + collection_name='community.general' + ) + category = module.params['category'] command_list = module.params['command'] diff --git a/plugins/modules/redfish_info.py b/plugins/modules/redfish_info.py index 364df40b5f..89ee4c0897 100644 --- a/plugins/modules/redfish_info.py +++ b/plugins/modules/redfish_info.py @@ -60,7 +60,8 @@ options: timeout: description: - Timeout in seconds for HTTP requests to OOB controller. - default: 10 + - The default value for this param is C(10) but that is being deprecated + and it will be replaced with C(60) in community.general 9.0.0. type: int update_handle: required: false @@ -386,7 +387,7 @@ def main(): username=dict(), password=dict(no_log=True), auth_token=dict(no_log=True), - timeout=dict(type='int', default=10), + timeout=dict(type='int'), update_handle=dict(), ), required_together=[ @@ -401,6 +402,16 @@ def main(): supports_check_mode=True, ) + if module.params['timeout'] is None: + timeout = 10 + module.deprecate( + 'The default value {0} for parameter param1 is being deprecated and it will be replaced by {1}'.format( + 10, 60 + ), + version='9.0.0', + collection_name='community.general' + ) + # admin credentials used for authentication creds = {'user': module.params['username'], 'pswd': module.params['password'],