incubator-tashi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strou...@apache.org
Subject svn commit: r1292895 - in /incubator/tashi/trunk: ./ src/tashi/clustermanager/data/pickled.py
Date Thu, 23 Feb 2012 18:55:09 GMT
Author: stroucki
Date: Thu Feb 23 18:55:08 2012
New Revision: 1292895

URL: http://svn.apache.org/viewvc?rev=1292895&view=rev
Log:
bring in pickled database corruption fix to trunk

Modified:
    incubator/tashi/trunk/   (props changed)
    incubator/tashi/trunk/src/tashi/clustermanager/data/pickled.py

Propchange: incubator/tashi/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Feb 23 18:55:08 2012
@@ -3,6 +3,6 @@
 /incubator/tashi/branches/stablefix:1203848-1241770
 /incubator/tashi/branches/stroucki-accounting:1221525-1241770
 /incubator/tashi/branches/stroucki-accounting/branches/stroucki-accounting:1221525-1235607
-/incubator/tashi/branches/stroucki-irpbugs:1245857-1292484
+/incubator/tashi/branches/stroucki-irpbugs:1245857-1292894
 /incubator/tashi/branches/stroucki-slotsbug:1244839-1245041
 /incubator/tashi/branches/zoni-dev/trunk:1034098-1177646

Modified: incubator/tashi/trunk/src/tashi/clustermanager/data/pickled.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/clustermanager/data/pickled.py?rev=1292895&r1=1292894&r2=1292895&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/clustermanager/data/pickled.py (original)
+++ incubator/tashi/trunk/src/tashi/clustermanager/data/pickled.py Thu Feb 23 18:55:08 2012
@@ -52,9 +52,14 @@ class Pickled(FromConfig):
 		return ch
 	
 	def save(self):
-		file = open(self.file, "w")
+		filename = self.file
+		# XXXstroucki could be better
+		tempfile = "%s.new" % filename
+
+		file = open(tempfile, "w")
 		cPickle.dump((self.cleanHosts(), self.cleanInstances(), self.networks, self.users), file)
 		file.close()
+		os.rename(tempfile, filename)
 
 	def load(self):
 		if (os.access(self.file, os.F_OK)):



Mime
View raw message