use full paths for invoked commands
This commit is contained in:
parent
ea278eeb35
commit
7aee6c8838
1 changed files with 8 additions and 4 deletions
|
@ -19,6 +19,10 @@ from gvafile.exceptions import GVAFileException
|
|||
|
||||
_logger = get_task_logger(__name__)
|
||||
|
||||
SUDO_CMD = '/usr/bin/sudo'
|
||||
INSTALL_CMD = '/usr/bin/install'
|
||||
SETFACL_CMD = '/usr/bin/setfacl'
|
||||
|
||||
|
||||
def _build_sftp_directory_name(username):
|
||||
"""
|
||||
|
@ -53,11 +57,11 @@ def setup_file_sftp_userdir(username):
|
|||
sftp_directory = _build_sftp_directory_name(username)
|
||||
try:
|
||||
subprocess.check_output([
|
||||
'sudo', 'install', '-o', username, '-g', username, '-m', '0750',
|
||||
'-d', sftp_directory], stderr=subprocess.STDOUT)
|
||||
SUDO_CMD, INSTALL_CMD, '-o', username, '-g', username,
|
||||
'-m', '0750', '-d', sftp_directory], stderr=subprocess.STDOUT)
|
||||
subprocess.check_output([
|
||||
'sudo' 'setfacl', '-r', '-m', 'www-data:--x', sftp_directory],
|
||||
stderr=subprocess.STDOUT)
|
||||
SUDO_CMD, SETFACL_CMD, '-r', '-m', 'www-data:--x',
|
||||
sftp_directory], stderr=subprocess.STDOUT)
|
||||
except subprocess.CalledProcessError:
|
||||
_logger.exception(
|
||||
'could not create SFTP directory for user %s', username)
|
||||
|
|
Loading…
Reference in a new issue