From ab0b85d7d2196e36c00cf4316c55582bad3b53f3 Mon Sep 17 00:00:00 2001 From: Mike Raineri Date: Sun, 5 Nov 2023 23:49:48 -0500 Subject: [PATCH] Redfish: Updated message handling for update operations to skip message objects with missing MessageId properties (#7471) * Redfish: Updated message handling for update operations to skip message objects with missing MessageId properties Signed-off-by: Mike Raineri * Update 7465-redfish-firmware-update-message-id-hardening.yml --------- Signed-off-by: Mike Raineri --- .../7465-redfish-firmware-update-message-id-hardening.yml | 2 ++ plugins/module_utils/redfish_utils.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/7465-redfish-firmware-update-message-id-hardening.yml diff --git a/changelogs/fragments/7465-redfish-firmware-update-message-id-hardening.yml b/changelogs/fragments/7465-redfish-firmware-update-message-id-hardening.yml new file mode 100644 index 0000000000..01a98c2225 --- /dev/null +++ b/changelogs/fragments/7465-redfish-firmware-update-message-id-hardening.yml @@ -0,0 +1,2 @@ +bugfixes: + - redfish_command - fix usage of message parsing in ``SimpleUpdate`` and ``MultipartHTTPPushUpdate`` commands to treat the lack of a ``MessageId`` as no message (https://github.com/ansible-collections/community.general/issues/7465, https://github.com/ansible-collections/community.general/pull/7471). diff --git a/plugins/module_utils/redfish_utils.py b/plugins/module_utils/redfish_utils.py index 6c470c7da3..cea1fd1034 100644 --- a/plugins/module_utils/redfish_utils.py +++ b/plugins/module_utils/redfish_utils.py @@ -1658,7 +1658,10 @@ class RedfishUtils(object): # Scan the messages to see if next steps are needed for message in operation_results['messages']: - message_id = message['MessageId'] + message_id = message.get('MessageId') + if message_id is None: + # While this is invalid, treat the lack of a MessageId as "no message" + continue if message_id.startswith('Update.1.') and message_id.endswith('.OperationTransitionedToJob'): # Operation rerouted to a job; update the status and handle