# HG changeset patch # User Jeff Hammel # Date 1273278013 25200 # Node ID a63dd19807c807a7209080ec8f7437cba3821107 # Parent b6bb59b79525aba9307522dedbe16cb7ac82d850 * actually write the file * dont fatally err if a backup isnt actually there diff -r b6bb59b79525 -r a63dd19807c8 profilemanager/manager.py --- 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