2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-26 03:19:48 +00:00

Fix silent feedback to client in some ipmi scenarios

Provide specific feedback to client when possible.  When not possible,
at least get condition into the correct trace log and notify client of
condition.
This commit is contained in:
Jarrod Johnson 2015-03-26 09:24:23 -04:00
parent 093e9faec4
commit 26a969c41a
4 changed files with 18 additions and 10 deletions

View File

@ -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'

View File

@ -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()

View File

@ -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(

View File

@ -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,