mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-25 11:01:09 +00:00
Improve error reporting by server
General errors were uncaught. Provide a way to relate unexpected situations more gracefully to a client.
This commit is contained in:
parent
8d09fb4064
commit
763ccf823f
@ -144,10 +144,9 @@ class ConfluentMessage(object):
|
||||
|
||||
|
||||
class ConfluentNodeError(object):
|
||||
def __init__(self, node):
|
||||
def __init__(self, node, errorstr):
|
||||
self.node = node
|
||||
self.error = None
|
||||
raise NotImplementedError # this is an abstract base class
|
||||
self.error = errorstr
|
||||
|
||||
def raw(self):
|
||||
return {self.node: {'error': self.error}}
|
||||
@ -158,7 +157,7 @@ class ConfluentNodeError(object):
|
||||
def strip_node(self, node):
|
||||
#NOTE(jbjohnso): For single node errors, raise exception to
|
||||
#trigger what a developer of that medium would expect
|
||||
raise NotImplementedError
|
||||
raise Exception(self.error)
|
||||
|
||||
|
||||
class ConfluentTargetTimeout(ConfluentNodeError):
|
||||
|
@ -222,11 +222,10 @@ def perform_request(operator, node, element,
|
||||
if excmsg == 'Session no longer connected':
|
||||
results.put(msg.ConfluentTargetTimeout(node))
|
||||
else:
|
||||
raise
|
||||
results.put(msg.ConfluentNodeError(node, excmsg))
|
||||
finally:
|
||||
results.put('Done')
|
||||
|
||||
|
||||
persistent_ipmicmds = {}
|
||||
|
||||
|
||||
@ -427,8 +426,7 @@ class IpmiHandler(object):
|
||||
state=power['powerstate']))
|
||||
elif 'update' == self.op:
|
||||
powerstate = self.inputdata.powerstate(self.node)
|
||||
# TODO: call with wait argument
|
||||
self.ipmicmd.set_power(powerstate)
|
||||
self.ipmicmd.set_power(powerstate, wait=30)
|
||||
power = self.ipmicmd.get_power()
|
||||
self.output.put(msg.PowerState(node=self.node,
|
||||
state=power['powerstate']))
|
||||
|
Loading…
Reference in New Issue
Block a user