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

Merge pull request #4988 from gurevichmark/openbmc_getbmcstate

Catch BMC status error from get status request
This commit is contained in:
xuweibj 2018-03-23 09:32:23 +08:00 committed by GitHub
commit 8dc18c3989
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -85,9 +85,10 @@ class OpenBMCPowerTask(ParallelNodesCommand):
self.callback.info('%s: %s' % (node, openbmc.RPOWER_STATES.get(bmc_state, bmc_state)))
except SelfServerException, SelfClientException:
# There is no response when BMC is not ready
except SelfServerException as e:
self.callback.error(openbmc.RPOWER_STATES[bmc_not_ready], node)
except SelfClientException as e:
self.callback.error("%s (%s)" % (openbmc.RPOWER_STATES[bmc_not_ready], e.message), node)
return bmc_state

View File

@ -424,8 +424,8 @@ class OpenBMCRest(object):
def get_bmc_state(self):
state = self.request('GET', BMC_URLS['state']['path'], cmd='get_bmc_state')
try:
state = self.request('GET', BMC_URLS['state']['path'], cmd='get_bmc_state')
return {'bmc': state.split('.')[-1]}
except KeyError:
error = 'Received wrong format response: %s' % state