Author: nunofsantos
Date: 2008-05-15 09:22:36 -0400 (Thu, 15 May 2008)
New Revision: 2051
Modified:
mgmt/mint/python/mint/__init__.py
mgmt/mint/python/mint/schema.py
mgmt/mint/sql/schema.sql
Log:
handle missing key in map lookup
Modified: mgmt/mint/python/mint/__init__.py
===================================================================
--- mgmt/mint/python/mint/__init__.py 2008-05-14 20:18:00 UTC (rev 2050)
+++ mgmt/mint/python/mint/__init__.py 2008-05-15 13:22:36 UTC (rev 2051)
@@ -403,42 +403,35 @@
conn = self.connections[brokerId]
d["recTime"] = datetime.fromtimestamp(timestamps[0]/1000000000)
self.log(d)
- obj = conn.getByOriginalId(schema.schemaNameToClassMap[objectName],
d[self.convertIdKey("id")])
- if not obj:
- print "lion", classInfo, list
- return
+ try:
+ obj = conn.getByOriginalId(schema.schemaNameToClassMap[objectName],
d[self.convertIdKey("id")])
+ if not obj:
+ print "lion", classInfo, list
+ return
- d[objectName] = obj
- objNameStats = eval("schema.%sStats" %
(schema.schemaNameToClassMap[objectName].__name__))
- objStats = objNameStats.__new__(objNameStats)
- objStats.__init__()
+ d[objectName] = obj
+ objNameStats = eval("schema.%sStats" %
(schema.schemaNameToClassMap[objectName].__name__))
+ objStats = objNameStats.__new__(objNameStats)
+ objStats.__init__()
- try:
objStats.set(**d)
- except TypeError, detail:
- self.log("Schema mismatch: %s" % detail)
-
- try:
objStats.syncUpdate()
- except ProgrammingError, detail
- # XXX FIX
- self.log("SQL syntax error: %s" % detail)
- return
- d = dict()
- if (timestamps[2] != 0):
- d["deletionTime"] = datetime.fromtimestamp(timestamps[2]/1000000000)
- d["statsPrev"] = obj.statsCurr
- d["statsCurr"] = objStats
+ d = dict()
+ if (timestamps[2] != 0):
+ d["deletionTime"] = datetime.fromtimestamp(timestamps[2]/1000000000)
+ d["statsPrev"] = obj.statsCurr
+ d["statsCurr"] = objStats
- try:
obj.set(**d)
+ obj.syncUpdate()
except TypeError, detail:
self.log("Schema mismatch: %s" % detail)
-
- try:
- obj.syncUpdate()
+ return
+ except KeyError, detail:
+ self.log("Schema mismatch: %s" % detail)
+ return
except ProgrammingError, detail:
# XXX FIX
self.log("SQL syntax error: %s" % detail)
Modified: mgmt/mint/python/mint/schema.py
===================================================================
--- mgmt/mint/python/mint/schema.py 2008-05-14 20:18:00 UTC (rev 2050)
+++ mgmt/mint/python/mint/schema.py 2008-05-15 13:22:36 UTC (rev 2051)
@@ -421,14 +421,14 @@
conn.callMethod(self.idOriginal, classInfo, "close",
callback, args=actualArgs)
- def bridge(self, model, callback, durable, src, dest, key, id, excludes, src_is_queue,
src_is_local):
+ def bridge(self, model, callback, durable, src, dest, key, tag, excludes, src_is_queue,
src_is_local):
"""Bridge messages over the link"""
actualArgs = dict()
actualArgs["durable"] = durable
actualArgs["src"] = src
actualArgs["dest"] = dest
actualArgs["key"] = key
- actualArgs["id"] = id
+ actualArgs["tag"] = tag
actualArgs["excludes"] = excludes
actualArgs["src_is_queue"] = src_is_queue
actualArgs["src_is_local"] = src_is_local
@@ -468,11 +468,14 @@
statsPrev = ForeignKey('BridgeStats', cascade='null', default=None)
link = ForeignKey('Link', cascade='null', default=None)
channelId = SmallIntCol(default=None)
+ durable = BoolCol(default=None)
src = StringCol(length=1000, default=None)
dest = StringCol(length=1000, default=None)
key = StringCol(length=1000, default=None)
srcIsQueue = BoolCol(default=None)
srcIsLocal = BoolCol(default=None)
+ tag = StringCol(length=1000, default=None)
+ excludes = StringCol(length=1000, default=None)
classInfos = dict() # brokerId => classInfo
Modified: mgmt/mint/sql/schema.sql
===================================================================
--- mgmt/mint/sql/schema.sql 2008-05-14 20:18:00 UTC (rev 2050)
+++ mgmt/mint/sql/schema.sql 2008-05-15 13:22:36 UTC (rev 2051)
@@ -107,11 +107,14 @@
stats_prev_id INT,
link_id INT,
channel_id SMALLINT,
+ durable BOOL,
src VARCHAR(1000),
dest VARCHAR(1000),
key VARCHAR(1000),
src_is_queue BOOL,
- src_is_local BOOL
+ src_is_local BOOL,
+ tag VARCHAR(1000),
+ excludes VARCHAR(1000)
);
CREATE TABLE bridge_stats (