2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-22 03:32:04 +00:00

modify login error msg for openbmc python

This commit is contained in:
XuWei 2018-03-27 22:05:44 -04:00
parent 5da3a4f945
commit eb72bdf84f
2 changed files with 6 additions and 8 deletions

View File

@ -51,12 +51,7 @@ class OpenBMCPowerTask(ParallelNodesCommand):
bmc_not_ready = bmc_state = 'NotReady'
try:
obmc.login()
except SelfServerException as e:
# Special exception handling for login failure
login_message = "Login to BMC failed: Can't connect to {0} {1}.".format(e.host_and_port, e.detail_msg)
self.callback.error(login_message, node)
return bmc_state
except SelfClientException as e:
except (SelfServerException, SelfClientException) as e:
self.callback.error(e.message, node)
return bmc_state

View File

@ -335,8 +335,11 @@ class OpenBMCRest(object):
response = self.session.request(method, url, httpheaders, data=data, timeout=timeout)
return self.handle_response(response, cmd=cmd)
except SelfServerException as e:
e.message = 'BMC did not respond. ' \
'Validate BMC configuration and retry the command.'
if cmd == 'login':
e.message = "Login to BMC failed: Can't connect to {0} {1}.".format(e.host_and_port, e.detail_msg)
else:
e.message = 'BMC did not respond. ' \
'Validate BMC configuration and retry the command.'
self._print_error_log(e.message, cmd)
raise
except ValueError: