summaryrefslogtreecommitdiffstats
path: root/pyfirstaidkit
diff options
context:
space:
mode:
authorJoel Andres Granados <jgranado@redhat.com>2008-05-30 17:57:48 +0200
committerJoel Andres Granados <jgranado@redhat.com>2008-05-30 17:57:48 +0200
commita3a5eff6af00a7b5c2d968f4ea3ee4c94cc40027 (patch)
tree6f1cdbb8d137114d409994e1ffc44974c2692aab /pyfirstaidkit
parent2479571f77597141a213cbb771cde3ba88d16eef (diff)
downloadfirstaidkit-a3a5eff6af00a7b5c2d968f4ea3ee4c94cc40027.tar.gz
firstaidkit-a3a5eff6af00a7b5c2d968f4ea3ee4c94cc40027.tar.xz
firstaidkit-a3a5eff6af00a7b5c2d968f4ea3ee4c94cc40027.zip
Check to see if the backup dir is present when creating it.
If firstaidkit is run and does not end properly it is possible for the backup dir to already be there. The sane thing to do is to tell the user.
Diffstat (limited to 'pyfirstaidkit')
-rw-r--r--pyfirstaidkit/utils/backup.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/pyfirstaidkit/utils/backup.py b/pyfirstaidkit/utils/backup.py
index f68b154..d9bc1b9 100644
--- a/pyfirstaidkit/utils/backup.py
+++ b/pyfirstaidkit/utils/backup.py
@@ -179,7 +179,10 @@ class FileBackupStore(BackupStoreInterface):
self._path = path
self._backups = {}
- os.makedirs(self._path)
+ if os.path.isdir(self._path):
+ raise BackupException("Backupdir %s already exists. Erase dir or change backup dir." % self._path)
+ else:
+ os.makedirs(self._path)
self.__class__._singleton = weakref.proxy(self)
print "Backup system initialized"