diff --git a/confluent_server/confluent/httpapi.py b/confluent_server/confluent/httpapi.py index b1c70b21..650dcbf3 100644 --- a/confluent_server/confluent/httpapi.py +++ b/confluent_server/confluent/httpapi.py @@ -399,9 +399,9 @@ def resourcehandler_backend(env, start_response): except exc.InvalidArgumentException as e: start_response('400 Bad Request - ' + str(e), headers) yield '400 - Bad Request - ' + str(e) - except exc.TargetEndpointUnreachable: + except exc.TargetEndpointUnreachable as tu: start_response('504 Unreachable Target', headers) - yield '504 - Unreachable Target' + yield '504 - Unreachable Target - ' + str(tu) except exc.TargetEndpointBadCredentials: start_response('502 Bad Credentials', headers) yield '502 - Bad Credentials' diff --git a/confluent_server/confluent/messages.py b/confluent_server/confluent/messages.py index 1d5ea89a..61fe9346 100644 --- a/confluent_server/confluent/messages.py +++ b/confluent_server/confluent/messages.py @@ -169,12 +169,12 @@ class ConfluentNodeError(object): class ConfluentTargetTimeout(ConfluentNodeError): - def __init__(self, node): + def __init__(self, node, errstr='timeout'): self.node = node - self.error = 'timeout' + self.error = errstr def strip_node(self, node): - raise exc.TargetEndpointUnreachable + raise exc.TargetEndpointUnreachable(self.error) class ConfluentTargetNotFound(ConfluentNodeError): @@ -300,7 +300,7 @@ def get_input_message(path, operation, inputdata, nodes=None): return InputAttributes(path, inputdata, nodes) elif path == ['boot', 'nextdevice'] and operation != 'retrieve': return InputBootDevice(path, nodes, inputdata) - elif path == [ 'identify' ] and operation != 'retrieve': + elif path == ['identify'] and operation != 'retrieve': return InputIdentifyMessage(path, nodes, inputdata) elif inputdata: raise exc.InvalidArgumentException() diff --git a/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py b/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py index 11cff648..8431886e 100644 --- a/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py +++ b/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py @@ -223,6 +223,10 @@ def perform_request(operator, node, element, results.put(msg.ConfluentTargetTimeout(node)) else: results.put(msg.ConfluentNodeError(node, excmsg)) + except exc.TargetEndpointUnreachable as tu: + results.put(msg.ConfluentTargetTimeout(str(tu))) + except Exception as e: + results.put(msg.ConfluentNodeError(node, str(e))) finally: results.put('Done') @@ -285,8 +289,11 @@ class IpmiHandler(object): self._logevt.wait() self._logevt = None if self.broken: - if self.error == 'timeout': - self.output.put(msg.ConfluentTargetTimeout(self.node)) + if (self.error == 'timeout' or + 'Insufficient resources' in self.error): + self.error = self.error.replace(' reported in RAKP4','') + self.output.put(msg.ConfluentTargetTimeout( + self.node, self.error)) elif ('Unauthorized' in self.error or 'Incorrect password' in self.error): self.output.put( diff --git a/confluent_server/confluent/sockapi.py b/confluent_server/confluent/sockapi.py index ead744aa..9a0d191b 100644 --- a/confluent_server/confluent/sockapi.py +++ b/confluent_server/confluent/sockapi.py @@ -115,9 +115,10 @@ def sessionhdl(connection, authname, skipauth=False): tlvdata.send(connection, {'errorcode': 502, 'error': 'Bad Credentials'}) tlvdata.send(connection, {'_requestdone': 1}) - except exc.TargetEndpointUnreachable: + except exc.TargetEndpointUnreachable as tu: tlvdata.send(connection, {'errorcode': 504, - 'error': 'Unreachable Target'}) + 'error': 'Unreachable Target - ' + str( + tu)}) tlvdata.send(connection, {'_requestdone': 1}) except exc.NotImplementedException: tlvdata.send(connection, {'errorcode': 501,