entropy.server, try using atomic os.rename method

This commit is contained in:
Fabio Erculiani
2009-06-01 17:05:21 +02:00
parent 52362f8d64
commit 2b014c4fa7
+4 -1
View File
@@ -1938,7 +1938,10 @@ class Server(Singleton, TextInterface):
repo = repo)
downloadfile = os.path.basename(download_url)
destination_path = os.path.join(upload_dir, downloadfile)
shutil.move(package_file, destination_path)
try:
os.rename(package_file, destination_path)
except OSError:
shutil.move(package_file, destination_path)
dbconn.commitChanges()
return idpackage, destination_path