From 7c659f2f5a6f18dcea0804908c8b3a9bf71a38d2 Mon Sep 17 00:00:00 2001 From: tony Date: Wed, 8 Apr 2015 08:36:46 +0200 Subject: [PATCH] Added exception management for workdir preparation. --- xtrabackup/backup_tools.py | 6 +++++- xtrabackup/filesystem_utils.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/xtrabackup/backup_tools.py b/xtrabackup/backup_tools.py index bd708e0..77a5a30 100644 --- a/xtrabackup/backup_tools.py +++ b/xtrabackup/backup_tools.py @@ -29,7 +29,11 @@ def check_prerequisites(self, repository): raise def prepare_workdir(self, path): - filesystem_utils.mkdir_path(path, 0o755) + try: + filesystem_utils.mkdir_path(path, 0o755) + except exception.ProgramError: + self.logger.error('Workdir preparation failed.', exc_info=True) + raise self.workdir = path + '/xtrabackup_tmp' self.logger.debug("Temporary workdir: " + self.workdir) if self.compress: diff --git a/xtrabackup/filesystem_utils.py b/xtrabackup/filesystem_utils.py index 93860b9..e4f77b3 100644 --- a/xtrabackup/filesystem_utils.py +++ b/xtrabackup/filesystem_utils.py @@ -39,7 +39,7 @@ def mkdir_path(path, mode): if exc.errno == errno.EEXIST and os.path.isdir(path): pass else: - raise + raise ProgramError("Unable to create directory: " + path) def check_required_binaries(binaries):