mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-31 03:12:30 +00:00 
			
		
		
		
	Catch BMC status error from get status request
This commit is contained in:
		| @@ -82,6 +82,11 @@ class OpenBMCPowerTask(ParallelNodesCommand): | ||||
|  | ||||
|             if bmc_state != 'Ready': | ||||
|                 bmc_state = bmc_not_ready | ||||
|                 bmc_state_error = state.get('error') | ||||
|                 if bmc_state_error is not None: | ||||
|                     # BMC is not ready and we have some error as to why | ||||
|                     self.callback.info('%s: %s (%s)' % (node, openbmc.RPOWER_STATES.get(bmc_state, bmc_state), bmc_state_error)) | ||||
|                     return bmc_state | ||||
|  | ||||
|             self.callback.info('%s: %s' % (node, openbmc.RPOWER_STATES.get(bmc_state, bmc_state))) | ||||
|  | ||||
|   | ||||
| @@ -320,6 +320,8 @@ class OpenBMCRest(object): | ||||
|                         'Validate BMC configuration and retry the command.' | ||||
|             self._print_error_log(e.message, cmd) | ||||
|             raise | ||||
|         except SelfClientException as e: | ||||
|             raise SelfClientException(e.message, e.code) | ||||
|         except ValueError: | ||||
|             error = 'Received wrong format response: %s' % response | ||||
|             self._print_error_log(error, cmd) | ||||
| @@ -410,9 +412,12 @@ 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 SelfClientException as e: | ||||
|             # Return error message received from the request | ||||
|             return {'bmc': "NotReady", 'error': e.message} | ||||
|         except KeyError: | ||||
|             error = 'Received wrong format response: %s' % state | ||||
|             raise SelfServerException(error) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user