mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-18 16:31:26 -07:00
[PR #9123/1f786a61 backport][stable-10] redfish_command: add update_custom_oem options (#9136)
redfish_command: add update_custom_oem options (#9123)
* redfish_command: add update_custom_oem options
The Multipart HTTP push update implementation allows OEM specific
parts that are not part of the `UpdateParameters` body part, but a
separate one. This OEM part shall start with `Oem` and is optional.
The OEM part implementation is specified in the Redfish spec point
12.6.2.2 [1].
Right now, the implementation will only support JSON as MIME Type,
although it is not limited to JSON.
[1] https://www.dmtf.org/sites/default/files/standards/documents/DSP0266_1.21.0.html#oem
Signed-off-by: Tan Siewert <tan@siewert.io>
* redfish_command: add option to set custom mime type
The implementation of using a custom MIME type will also remove the
default JSON type.
Converting the payload to JSON or any other type is up to the user.
Signed-off-by: Tan Siewert <tan@siewert.io>
* redfish_command: apply docs changes from review
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
* redfish_command: add mime type option to changelog
Co-authored-by: Felix Fontein <felix@fontein.de>
---------
Signed-off-by: Tan Siewert <tan@siewert.io>
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 1f786a6171
)
Co-authored-by: Tan Siewert <tom@siewert.io>
This commit is contained in:
parent
88b1fbbdf0
commit
c916052124
3 changed files with 64 additions and 0 deletions
|
@ -1933,6 +1933,9 @@ class RedfishUtils(object):
|
|||
targets = update_opts.get('update_targets')
|
||||
apply_time = update_opts.get('update_apply_time')
|
||||
oem_params = update_opts.get('update_oem_params')
|
||||
custom_oem_header = update_opts.get('update_custom_oem_header')
|
||||
custom_oem_mime_type = update_opts.get('update_custom_oem_mime_type')
|
||||
custom_oem_params = update_opts.get('update_custom_oem_params')
|
||||
|
||||
# Ensure the image file is provided
|
||||
if not image_file:
|
||||
|
@ -1969,6 +1972,11 @@ class RedfishUtils(object):
|
|||
'UpdateParameters': {'content': json.dumps(payload), 'mime_type': 'application/json'},
|
||||
'UpdateFile': {'filename': image_file, 'content': image_payload, 'mime_type': 'application/octet-stream'}
|
||||
}
|
||||
if custom_oem_params:
|
||||
multipart_payload[custom_oem_header] = {'content': custom_oem_params}
|
||||
if custom_oem_mime_type:
|
||||
multipart_payload[custom_oem_header]['mime_type'] = custom_oem_mime_type
|
||||
|
||||
response = self.post_request(self.root_uri + update_uri, multipart_payload, multipart=True)
|
||||
if response['ret'] is False:
|
||||
return response
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue