From 4a5dea70ce63807f12e66328dab77093b9761962 Mon Sep 17 00:00:00 2001 From: Scott Seekamp Date: Mon, 2 Oct 2023 13:46:29 -0600 Subject: [PATCH] Add support for Oem params (#7330) * Add support for "Oem" parameters in the MultipartHTTPPushUpdate redfish_command * Add doc entry * Add changelog fragment Add version_added field * Re-word the changelog fragment * After further testing this should not have a default definition as it should not be in the payload if not defined --- changelogs/fragments/7330-redfish-utils-oem-params.yml | 2 ++ plugins/module_utils/redfish_utils.py | 3 +++ plugins/modules/redfish_command.py | 10 ++++++++++ 3 files changed, 15 insertions(+) create mode 100644 changelogs/fragments/7330-redfish-utils-oem-params.yml diff --git a/changelogs/fragments/7330-redfish-utils-oem-params.yml b/changelogs/fragments/7330-redfish-utils-oem-params.yml new file mode 100644 index 00000000000..5e39779527d --- /dev/null +++ b/changelogs/fragments/7330-redfish-utils-oem-params.yml @@ -0,0 +1,2 @@ +minor_changes: + - redfish_command - add new option ``update_oem_params`` for the ``MultipartHTTPPushUpdate`` command (https://github.com/ansible-collections/community.general/issues/7331). diff --git a/plugins/module_utils/redfish_utils.py b/plugins/module_utils/redfish_utils.py index b09a1b5b04b..1923d915b66 100644 --- a/plugins/module_utils/redfish_utils.py +++ b/plugins/module_utils/redfish_utils.py @@ -1745,6 +1745,7 @@ def multipath_http_push_update(self, update_opts): image_file = update_opts.get('update_image_file') targets = update_opts.get('update_targets') apply_time = update_opts.get('update_apply_time') + oem_params = update_opts.get('update_oem_params') # Ensure the image file is provided if not image_file: @@ -1775,6 +1776,8 @@ def multipath_http_push_update(self, update_opts): payload["Targets"] = targets if apply_time: payload["@Redfish.OperationApplyTime"] = apply_time + if oem_params: + payload["Oem"] = oem_params multipart_payload = { 'UpdateParameters': {'content': json.dumps(payload), 'mime_type': 'application/json'}, 'UpdateFile': {'filename': image_file, 'content': image_payload, 'mime_type': 'application/octet-stream'} diff --git a/plugins/modules/redfish_command.py b/plugins/modules/redfish_command.py index 908eb95c879..e66380493cc 100644 --- a/plugins/modules/redfish_command.py +++ b/plugins/modules/redfish_command.py @@ -203,6 +203,12 @@ - InMaintenanceWindowOnReset - OnStartUpdateRequest version_added: '6.1.0' + update_oem_params: + required: false + description: + - Properties for HTTP Multipart Push Updates. + type: dict + version_added: '7.5.0' update_handle: required: false description: @@ -601,6 +607,8 @@ update_image_file: ~/images/myupdate.img update_targets: - /redfish/v1/UpdateService/FirmwareInventory/BMC + update_oem_params: + PreserveConfiguration: false - name: Perform requested operations to continue the update community.general.redfish_command: @@ -792,6 +800,7 @@ def main(): update_image_file=dict(type='path'), update_protocol=dict(), update_targets=dict(type='list', elements='str', default=[]), + update_oem_params=dict(type='dict'), update_creds=dict( type='dict', options=dict( @@ -874,6 +883,7 @@ def main(): 'update_targets': module.params['update_targets'], 'update_creds': module.params['update_creds'], 'update_apply_time': module.params['update_apply_time'], + 'update_oem_params': module.params['update_oem_params'], 'update_handle': module.params['update_handle'], }