[PR #8434/961767e2 backport][stable-9] Redfish: Add options to check the availability of the service (#8457)

Redfish: Add options to check the availability of the service (#8434)

* Redfish: Add options to check the availability of the service

Signed-off-by: Mike Raineri <michael.raineri@dell.com>

* Updates based on review feedback

Signed-off-by: Mike Raineri <michael.raineri@dell.com>

* Updated comment to reflect changed behavior

Signed-off-by: Mike Raineri <michael.raineri@dell.com>

* Added changelog fragments

Signed-off-by: Mike Raineri <michael.raineri@dell.com>

* Update changelogs/fragments/8051-Redfish-Wait-For-Service.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/redfish_command.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/redfish_command.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/redfish_command.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/redfish_command.py

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Signed-off-by: Mike Raineri <michael.raineri@dell.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 961767e2dd)

Co-authored-by: Mike Raineri <mraineri@gmail.com>
This commit is contained in:
patchback[bot] 2024-06-03 07:15:58 +02:00 committed by GitHub
parent 9b8011d692
commit f214f206c3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 102 additions and 9 deletions

View file

@ -359,6 +359,16 @@ EXAMPLES = '''
baseuri: "{{ baseuri }}"
username: "{{ username }}"
password: "{{ password }}"
- name: Check the availability of the service with a timeout of 5 seconds
community.general.redfish_info:
category: Service
command: CheckAvailability
baseuri: "{{ baseuri }}"
username: "{{ username }}"
password: "{{ password }}"
timeout: 5
register: result
'''
RETURN = '''
@ -385,6 +395,7 @@ CATEGORY_COMMANDS_ALL = {
"GetUpdateStatus"],
"Manager": ["GetManagerNicInventory", "GetVirtualMedia", "GetLogs", "GetNetworkProtocols",
"GetHealthReport", "GetHostInterfaces", "GetManagerInventory", "GetServiceIdentification"],
"Service": ["CheckAvailability"],
}
CATEGORY_COMMANDS_DEFAULT = {
@ -393,7 +404,8 @@ CATEGORY_COMMANDS_DEFAULT = {
"Accounts": "ListUsers",
"Update": "GetFirmwareInventory",
"Sessions": "GetSessions",
"Manager": "GetManagerNicInventory"
"Manager": "GetManagerNicInventory",
"Service": "CheckAvailability",
}
@ -473,7 +485,13 @@ def main():
module.fail_json(msg="Invalid Category: %s" % category)
# Organize by Categories / Commands
if category == "Systems":
if category == "Service":
# service-level commands are always available
for command in command_list:
if command == "CheckAvailability":
result["service"] = rf_utils.check_service_availability()
elif category == "Systems":
# execute only if we find a Systems resource
resource = rf_utils._find_systems_resource()
if resource['ret'] is False: