Author: justi9
Date: 2010-06-08 14:35:59 -0400 (Tue, 08 Jun 2010)
New Revision: 4016
Modified:
mgmt/newdata/cumin/python/cumin/session.py
Log:
Better error reporting in qmf call
Modified: mgmt/newdata/cumin/python/cumin/session.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/session.py 2010-06-08 18:31:24 UTC (rev 4015)
+++ mgmt/newdata/cumin/python/cumin/session.py 2010-06-08 18:35:59 UTC (rev 4016)
@@ -60,25 +60,27 @@
agent = self.qmf_session._getAgentForAgentAddr(obj._qmf_agent_id)
- assert agent
+ if not agent:
+ raise Exception("Agent '%s' is unknown" %
obj._qmf_agent_id)
oid = ObjectId({"_agent_name": obj._qmf_agent_id,
"_object_name": obj._qmf_object_id})
- objs = agent.getObjects(_objectId=oid)
-
+ qmf_objs = agent.getObjects(_objectId=oid)
+
try:
- obj = objs[0]
+ qmf_obj = qmf_objs[0]
except IndexError:
- raise Exception("XXX no object!")
+ raise Exception("Object '%s' is unknown" %
obj._qmf_object_id)
self.lock.acquire()
try:
- seq = obj._invoke(name, args, {"_async": True})
+ seq = qmf_obj._invoke(name, args, {"_async": True})
- if seq is not None:
- self.outstanding_method_calls[seq] = callback
+ assert seq is not None
+ self.outstanding_method_calls[seq] = callback
+
return seq
finally:
self.lock.release()