Remove disfunctional create_web_php_fpm_pool_config code

This commit is contained in:
Jan Dittberner 2020-03-02 10:11:02 +01:00
parent dbb0910f9b
commit d6a71f495f
1 changed files with 7 additions and 20 deletions

View File

@ -40,6 +40,11 @@ def log_and_raise(exception, message, *args):
raise Exception(message % args)
def log_without_raise(exception, message, *args):
logargs = list(args) + [exception.returncode, exception.output]
_LOGGER.error(message + "\nreturncode: %d\noutput:\n%s", *logargs)
def _build_vhost_config_path(sitename):
return os.path.join(settings.GVAWEB_NGINX_SITES_AVAILABLE, sitename)
@ -178,25 +183,7 @@ def create_web_php_fpm_pool_config(username):
:rtype: boolean
"""
conftmpl = _get_template('fpmpool.conf')
confdata = conftmpl.render(user=username)
conffile = None
try:
fpmtemp, filename = mkstemp()
conffile = os.fdopen(fpmtemp, 'w')
conffile.write(confdata.encode('utf8'))
finally:
if conffile:
conffile.close()
try:
subprocess.check_output([
SUDO_CMD, INSTALL_CMD, '-o', 'root', '-g', 'root', '-m', '0644',
filename, _build_php_fpm_pool_file(username)],
stderr=subprocess.STDOUT)
subprocess.check_output([
SUDO_CMD, RM_CMD, filename], stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as cpe:
log_and_raise(cpe, 'could not configure PHP FPM for %s', username)
# TODO: implement PHP FPM docker management
return True
@ -215,6 +202,6 @@ def delete_web_php_fpm_pool_config(username):
SUDO_CMD, RM_CMD, "-f", _build_php_fpm_pool_file(username)],
stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as cpe:
log_and_raise(
log_without_raise(
cpe, 'could not delete PHP FPM configuration for %s', username)
return True