mirror of
https://github.com/xcat2/confluent.git
synced 2026-08-26 00:26:42 +00:00
Treat a bios link that is not served as no bios link
This bmc advertises a Bios resource on its system and answers 404 for it. Confluent followed the link and passed the bmc's complaint on as an unexpected error, so a nodeconfig read printed every bmc setting and then ended with "The requested resource of type named 'Bios' was not found", and the system half of the configuration was a 500 saying the same. There is already a good answer for a system that offers no bios settings, and a link that is advertised and not served is the same thing as far as a caller is concerned, so give it the same one. The result is checked once and remembered, including the negative, so this costs one request on the first ask and nothing after.
This commit is contained in:
@@ -688,11 +688,22 @@ class Command(object):
|
||||
return await oem.set_bootdev(bootdev, persist, uefiboot, self)
|
||||
|
||||
async def get_biosurl(self):
|
||||
if not self._varbiosurl:
|
||||
sysinfo = await self.sysinfo()
|
||||
self._varbiosurl = sysinfo.get('Bios', {}).get('@odata.id',
|
||||
None)
|
||||
if self._varbiosurl is None:
|
||||
sysinfo = await self.sysinfo()
|
||||
biosurl = sysinfo.get('Bios', {}).get('@odata.id', '')
|
||||
if biosurl:
|
||||
# A link may be advertised and not served. To a caller that is
|
||||
# the same as not having one, so answer the same way rather
|
||||
# than passing the bmc's complaint on as an unexpected error.
|
||||
try:
|
||||
await self._do_web_request(biosurl)
|
||||
except exc.RedfishError as re:
|
||||
if 'ResourceNotFound' not in str(re.msgid):
|
||||
raise
|
||||
biosurl = ''
|
||||
# '' is remembered as 'asked, and there is none'
|
||||
self._varbiosurl = biosurl
|
||||
if not self._varbiosurl:
|
||||
raise exc.UnsupportedFunctionality(
|
||||
'Bios management not detected on this platform')
|
||||
return self._varbiosurl
|
||||
|
||||
Reference in New Issue
Block a user