From b2acae7dda03bc127bf608f269cb21860c2fff6a Mon Sep 17 00:00:00 2001 From: Jan Dittberner Date: Thu, 25 Dec 2014 19:19:21 +0100 Subject: [PATCH] fix exception handling in setup_file_sftp_userdir --- gvafile/osusers/tasks.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/gvafile/osusers/tasks.py b/gvafile/osusers/tasks.py index 49b5a6c..34b09e4 100644 --- a/gvafile/osusers/tasks.py +++ b/gvafile/osusers/tasks.py @@ -44,8 +44,7 @@ def setup_file_sftp_userdir(username): The task is rejected if the directory creation fails. :param str username: the user name - :raises celery.exceptions.Reject: if the SFTP directory of the user cannot - be created + :raises Exception: if the SFTP directory of the user cannot be created :return: the created directory name :rtype: str @@ -58,12 +57,11 @@ def setup_file_sftp_userdir(username): subprocess.check_output([ 'sudo' 'setfacl', '-r', '-m', 'www-data:--x', sftp_directory], stderr=subprocess.STDOUT) - except subprocess.CalledProcessError as exc: + except subprocess.CalledProcessError: _logger.exception( - 'could not create SFTP directory for user %s: %s', - username, exc.output - ) - raise Reject(exc, requeue=False) + 'could not create SFTP directory for user %s', username) + raise Exception( + "could not create SFTP directory for user %s" % username) return sftp_directory