Author: justi9
Date: 2010-07-01 13:13:04 -0400 (Thu, 01 Jul 2010)
New Revision: 4062
Modified:
mgmt/newdata/mint/python/mint/model.py
mgmt/newdata/mint/python/mint/update.py
Log:
Defer adding objects to the cache until after the update completes; this fixes several
data exceptions (the 'unexpectedly null columns')
Modified: mgmt/newdata/mint/python/mint/model.py
===================================================================
--- mgmt/newdata/mint/python/mint/model.py 2010-06-30 20:32:30 UTC (rev 4061)
+++ mgmt/newdata/mint/python/mint/model.py 2010-07-01 17:13:04 UTC (rev 4062)
@@ -93,10 +93,11 @@
except RosemaryNotFound:
obj._id = cls.get_new_id(cursor)
- self.objects_by_id[object_id] = obj
-
return obj
+ def add_object(self, obj):
+ self.objects_by_id[obj._qmf_object_id] = obj
+
def delete_object(self, object_id):
try:
del self.objects_by_id[object_id]
Modified: mgmt/newdata/mint/python/mint/update.py
===================================================================
--- mgmt/newdata/mint/python/mint/update.py 2010-06-30 20:32:30 UTC (rev 4061)
+++ mgmt/newdata/mint/python/mint/update.py 2010-07-01 17:13:04 UTC (rev 4062)
@@ -274,6 +274,8 @@
raise
obj._sync_time = now
+
+ self.add_object(obj)
else:
stats.dropped += 1
@@ -300,6 +302,9 @@
return cls, obj
+ def add_object(self, obj):
+ self.agent.add_object(obj)
+
def process_headers(self, obj, columns):
table = obj._class.sql_table