mirror of
https://github.com/xcat2/confluent.git
synced 2026-08-04 00:17:01 +00:00
Restore some sanity to redfish error handling
This commit is contained in:
@@ -497,6 +497,8 @@ class Command(object):
|
||||
|
||||
async def bmcinfo(self):
|
||||
bmcurl = await self.get_bmcurl()
|
||||
if not bmcurl:
|
||||
raise exc.PyghmiException('Unable to identify BMC')
|
||||
return await self._do_web_request(bmcurl)
|
||||
|
||||
async def get_power(self):
|
||||
|
||||
@@ -17,11 +17,13 @@ from aiohmi.redfish.oem.lenovo import tsma
|
||||
from aiohmi.redfish.oem.lenovo import xcc
|
||||
from aiohmi.redfish.oem.lenovo import xcc3
|
||||
from aiohmi.redfish.oem.lenovo import smm3
|
||||
|
||||
import aiohmi.exceptions as exc
|
||||
|
||||
async def get_handler(sysinfo, sysurl, webclient, cache, cmd, rootinfo={}):
|
||||
if not sysinfo: # we are before establishing there is one system, and one manager...
|
||||
systems, status = await webclient.grab_json_response_with_status('/redfish/v1/Systems')
|
||||
if status == 401:
|
||||
raise exc.PyghmiException('Access Denied')
|
||||
if status == 200:
|
||||
for system in systems.get('Members', []):
|
||||
if system.get('@odata.id', '').endswith('/1'):
|
||||
|
||||
@@ -160,18 +160,8 @@ class IpmiCommandWrapper(ipmicommand.Command):
|
||||
kv = util.TLSCertVerifier(cfm, node,
|
||||
'pubkeys.tls_hardwaremanager', subject).verify_cert
|
||||
kwargs['verifycallback'] = kv
|
||||
self = await super().create(**kwargs)
|
||||
self.confluentbmcname = kwargs['bmc']
|
||||
self.cfm = cfm
|
||||
self.node = node
|
||||
self._inhealth = False
|
||||
self._lasthealth = None
|
||||
self._attribwatcher = cfm.watch_attributes(
|
||||
(node,), ('secret.hardwaremanagementuser', 'collective.manager',
|
||||
'secret.hardwaremanagementpassword',
|
||||
'hardwaremanagement.manager'), self._attribschanged)
|
||||
try:
|
||||
pass
|
||||
self = await super().create(**kwargs)
|
||||
except socket.error as se:
|
||||
if (hasattr(se, 'errno')
|
||||
and se.errno in (errno.ENETUNREACH, errno.EHOSTUNREACH, errno.EADDRNOTAVAIL)):
|
||||
@@ -188,6 +178,15 @@ class IpmiCommandWrapper(ipmicommand.Command):
|
||||
if 'Redfish not ready' in str(pe):
|
||||
raise exc.TargetEndpointUnreachable('Redfish is not supported by this system or is not yet ready')
|
||||
raise
|
||||
self.confluentbmcname = kwargs['bmc']
|
||||
self.cfm = cfm
|
||||
self.node = node
|
||||
self._inhealth = False
|
||||
self._lasthealth = None
|
||||
self._attribwatcher = cfm.watch_attributes(
|
||||
(node,), ('secret.hardwaremanagementuser', 'collective.manager',
|
||||
'secret.hardwaremanagementpassword',
|
||||
'hardwaremanagement.manager'), self._attribschanged)
|
||||
return self
|
||||
|
||||
def close_confluent(self):
|
||||
|
||||
Reference in New Issue
Block a user