mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 04:40:22 -07:00
Expose timeout option to Redfish modules (#54130)
* added timeout option to Redfish modules * Apply suggestions from code review Removed 'required: false' and added 'type: int' to 'timeout' documentation string. Co-Authored-By: billdodd <billdodd@gmail.com>
This commit is contained in:
parent
a47edc9968
commit
d8536e47d3
5 changed files with 57 additions and 13 deletions
|
@ -55,6 +55,12 @@ options:
|
|||
- value of BIOS attribute to update
|
||||
default: 'null'
|
||||
version_added: "2.8"
|
||||
timeout:
|
||||
description:
|
||||
- Timeout in seconds for URL requests to OOB controller
|
||||
default: 10
|
||||
type: int
|
||||
version_added: "2.8"
|
||||
|
||||
author: "Jose Delarosa (@jose-delarosa)"
|
||||
'''
|
||||
|
@ -90,13 +96,14 @@ EXAMPLES = '''
|
|||
username: "{{ username }}"
|
||||
password: "{{ password }}"
|
||||
|
||||
- name: Set BIOS default settings
|
||||
- name: Set BIOS default settings with a timeout of 20 seconds
|
||||
redfish_config:
|
||||
category: Systems
|
||||
command: SetBiosDefaultSettings
|
||||
baseuri: "{{ baseuri }}"
|
||||
username: "{{ username }}"
|
||||
password: "{{ password }}"
|
||||
timeout: 20
|
||||
'''
|
||||
|
||||
RETURN = '''
|
||||
|
@ -129,6 +136,7 @@ def main():
|
|||
password=dict(required=True, no_log=True),
|
||||
bios_attribute_name=dict(default='null'),
|
||||
bios_attribute_value=dict(default='null'),
|
||||
timeout=dict(type='int', default=10)
|
||||
),
|
||||
supports_check_mode=False
|
||||
)
|
||||
|
@ -140,6 +148,9 @@ def main():
|
|||
creds = {'user': module.params['username'],
|
||||
'pswd': module.params['password']}
|
||||
|
||||
# timeout
|
||||
timeout = module.params['timeout']
|
||||
|
||||
# BIOS attributes to update
|
||||
bios_attributes = {'bios_attr_name': module.params['bios_attribute_name'],
|
||||
'bios_attr_value': module.params['bios_attribute_value']}
|
||||
|
@ -147,7 +158,7 @@ def main():
|
|||
# Build root URI
|
||||
root_uri = "https://" + module.params['baseuri']
|
||||
rf_uri = "/redfish/v1/"
|
||||
rf_utils = RedfishUtils(creds, root_uri)
|
||||
rf_utils = RedfishUtils(creds, root_uri, timeout)
|
||||
|
||||
# Check that Category is valid
|
||||
if category not in CATEGORY_COMMANDS_ALL:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue