diff profilemanager/manager.py @ 75:a63dd19807c8

* actually write the file * dont fatally err if a backup isnt actually there
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 07 May 2010 17:20:13 -0700
parents b6bb59b79525
children e091caa41075
line wrap: on
line diff
--- a/profilemanager/manager.py	Fri May 07 17:09:32 2010 -0700
+++ b/profilemanager/manager.py	Fri May 07 17:20:13 2010 -0700
@@ -5,6 +5,7 @@
 import os
 import shutil
 import string
+import sys
 import tempfile
 import time
 import ConfigParser
@@ -195,7 +196,10 @@
                 backup_dir = backup
             else:
                 backup_dir = os.path.join(self.profile_dir, self.backups_dir, backup)
-            backups_dirs.append((backup, int(os.path.getmtime(backup_dir))))
+            try:
+                backups_dirs.append((backup, int(os.path.getmtime(backup_dir))))
+            except OSError:
+                print >> sys.stderr, "%s specified in %s, but the directory %s does not exist" % (backup, self.profiles, backup_dir)
         # TODO: check if the getmtime == the datestamp for relative backups
 
         # sort by reverse datestamp
@@ -297,6 +301,8 @@
                 if not os.listdir(backups_dir):
                     shutil.rmtree(backups_dir)
 
+            self.write(parser)
+
         # return which backup is restored
         return backup