fix exception handling in setup_file_sftp_userdir
This commit is contained in:
parent
1ad42ca4fd
commit
b2acae7dda
1 changed files with 5 additions and 7 deletions
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue