mirror of
https://github.com/xcat2/confluent.git
synced 2026-10-20 14:45:45 +00:00
Send If-Match with the redfish writes that lacked it
MegaRAC refuses a PATCH with no If-Match header, so setting the bmc hostname, ntp, the bmc network configuration, a location and ejecting media all failed with a precondition error. set_identify already passed etag=*; do the same at the call sites that did not, including the firmware push busy flag.
This commit is contained in:
@@ -945,7 +945,8 @@ class Command(object):
|
||||
netprotocols = bmcinfo.get('NetworkProtocol', {}).get('@odata.id', None)
|
||||
if netprotocols:
|
||||
request = {'NTP':{'ProtocolEnabled': enable}}
|
||||
await self._do_web_request(netprotocols, request, method='PATCH')
|
||||
await self._do_web_request(netprotocols, request, method='PATCH',
|
||||
etag='*')
|
||||
await self._do_web_request(netprotocols, cache=0)
|
||||
|
||||
async def get_ntp_servers(self):
|
||||
@@ -975,7 +976,8 @@ class Command(object):
|
||||
else:
|
||||
currntpservers[index] = server
|
||||
request = {'NTP':{'NTPServers': currntpservers}}
|
||||
await self._do_web_request(netprotocols, request, method='PATCH')
|
||||
await self._do_web_request(netprotocols, request, method='PATCH',
|
||||
etag='*')
|
||||
await self._do_web_request(netprotocols, cache=0)
|
||||
|
||||
async def clear_bmc_configuration(self):
|
||||
@@ -1047,7 +1049,7 @@ class Command(object):
|
||||
}]
|
||||
if patch:
|
||||
nicurl = await self._get_bmc_nic_url(name)
|
||||
await self._do_web_request(nicurl, patch, 'PATCH')
|
||||
await self._do_web_request(nicurl, patch, 'PATCH', etag='*')
|
||||
|
||||
async def set_net_configuration(self, ipv4_address=None, ipv4_configuration=None,
|
||||
ipv4_gateway=None, vlan_id=None, name=None):
|
||||
@@ -1085,14 +1087,14 @@ class Command(object):
|
||||
if patch:
|
||||
nicurl = await self._get_bmc_nic_url(name)
|
||||
try:
|
||||
await self._do_web_request(nicurl, patch, 'PATCH')
|
||||
await self._do_web_request(nicurl, patch, 'PATCH', etag='*')
|
||||
except exc.RedfishError:
|
||||
patch = {'IPv4Addresses': [ipinfo]}
|
||||
if dodhcp:
|
||||
ipinfo['AddressOrigin'] = 'DHCP'
|
||||
elif dodhcp is not None:
|
||||
ipinfo['AddressOrigin'] = 'Static'
|
||||
await self._do_web_request(nicurl, patch, 'PATCH')
|
||||
await self._do_web_request(nicurl, patch, 'PATCH', etag='*')
|
||||
|
||||
async def get_net6_configuration(self, name=None):
|
||||
nicurl = await self._get_bmc_nic_url(name)
|
||||
@@ -1147,7 +1149,7 @@ class Command(object):
|
||||
|
||||
async def set_hostname(self, hostname):
|
||||
await self._do_web_request(await self.get_bmcnicurl(),
|
||||
{'HostName': hostname}, 'PATCH')
|
||||
{'HostName': hostname}, 'PATCH', etag='*')
|
||||
|
||||
async def get_firmware(self, components=(), category=None):
|
||||
self._fwnamemap = {}
|
||||
@@ -1264,7 +1266,7 @@ class Command(object):
|
||||
for chassis in sysinfo.get('Links', {}).get('Chassis', []):
|
||||
chassisurl = chassis['@odata.id']
|
||||
await self._do_web_request(chassisurl, {'Location': locationinfo},
|
||||
method='PATCH')
|
||||
method='PATCH', etag='*')
|
||||
|
||||
async def oem(self):
|
||||
if not self._oem:
|
||||
@@ -1522,11 +1524,11 @@ class Command(object):
|
||||
await self._do_web_request(currl,
|
||||
{'Image': None,
|
||||
'Inserted': False},
|
||||
method='PATCH')
|
||||
method='PATCH', etag='*')
|
||||
except exc.RedfishError as re:
|
||||
if re.msgid.endswith(u'PropertyUnknown'):
|
||||
await self._do_web_request(currl, {'Image': None},
|
||||
method='PATCH')
|
||||
method='PATCH', etag='*')
|
||||
else:
|
||||
raise
|
||||
oem = await self.oem()
|
||||
|
||||
@@ -1458,7 +1458,8 @@ class OEMHandler(object):
|
||||
if 'HttpPushUriTargetsBusy' in usd:
|
||||
await self._do_web_request(
|
||||
'/redfish/v1/UpdateService',
|
||||
{'HttpPushUriTargetsBusy': False}, method='PATCH')
|
||||
{'HttpPushUriTargetsBusy': False}, method='PATCH',
|
||||
etag='*')
|
||||
|
||||
async def continue_update(self, rsp, progress):
|
||||
monitorurl = rsp['@odata.id']
|
||||
@@ -1524,7 +1525,8 @@ class OEMHandler(object):
|
||||
raise exc.UnsupportedFunctionality('Redfish firmware update only supported for implementations with push update support')
|
||||
if 'HttpPushUriTargetsBusy' in usd:
|
||||
await self._do_web_request('/redfish/v1/UpdateService',
|
||||
{'HttpPushUriTargetsBusy': True}, method='PATCH')
|
||||
{'HttpPushUriTargetsBusy': True}, method='PATCH',
|
||||
etag='*')
|
||||
|
||||
return usd,upurl,ismultipart
|
||||
|
||||
|
||||
Reference in New Issue
Block a user