Fail on non-existing path to backup

Change-Id: I897444a8eba24b61fcab4a694ad73b6688e31fb8
Closes-Bug: #1553146
This commit is contained in:
Pierre-Arthur MATHIEU 2016-07-07 16:41:05 +01:00
parent d5cf47c4eb
commit 1c9bba42ac
1 changed files with 5 additions and 1 deletions

View File

@ -142,7 +142,11 @@ class BackupJob(Job):
filepath = '.'
chdir_path = os.path.expanduser(
os.path.normpath(self.conf.path_to_backup.strip()))
if not os.path.exists(chdir_path):
msg = 'Path to backup does not exist {}'.format(
chdir_path)
LOG.critical(msg)
raise IOError(msg)
if not os.path.isdir(chdir_path):
filepath = os.path.basename(chdir_path)
chdir_path = os.path.dirname(chdir_path)