mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-18 16:31:26 -07:00
redfish: clean etag of quotes before patch (#3296)
* Some vendors surround header etag with quotes, which need to be cleaned before sending a patch * Minor change fragment * Add etag strip quote option * Rebase * Cleanup fragment * Apply suggestions from code review Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/remote_management/redfish/redfish_command.py Co-authored-by: Felix Fontein <felix@fontein.de> * Description update * Update plugins/modules/remote_management/redfish/redfish_config.py Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Kyle Williams <kyle.williams@thetradedesk.com> Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
7c493eb4e5
commit
3502f3b486
4 changed files with 36 additions and 5 deletions
|
@ -29,7 +29,7 @@ FAIL_MSG = 'Issuing a data modification command without specifying the '\
|
|||
class RedfishUtils(object):
|
||||
|
||||
def __init__(self, creds, root_uri, timeout, module, resource_id=None,
|
||||
data_modification=False):
|
||||
data_modification=False, strip_etag_quotes=False):
|
||||
self.root_uri = root_uri
|
||||
self.creds = creds
|
||||
self.timeout = timeout
|
||||
|
@ -37,6 +37,7 @@ class RedfishUtils(object):
|
|||
self.service_root = '/redfish/v1/'
|
||||
self.resource_id = resource_id
|
||||
self.data_modification = data_modification
|
||||
self.strip_etag_quotes = strip_etag_quotes
|
||||
self._init_session()
|
||||
|
||||
def _auth_params(self, headers):
|
||||
|
@ -121,6 +122,8 @@ class RedfishUtils(object):
|
|||
if not etag:
|
||||
etag = r['data'].get('@odata.etag')
|
||||
if etag:
|
||||
if self.strip_etag_quotes:
|
||||
etag = etag.strip('"')
|
||||
req_headers['If-Match'] = etag
|
||||
username, password, basic_auth = self._auth_params(req_headers)
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue