From d6a71f495f58af71d4d0d6fea1b1d3e1722c33a3 Mon Sep 17 00:00:00 2001 From: Jan Dittberner Date: Mon, 2 Mar 2020 10:11:02 +0100 Subject: [PATCH] Remove disfunctional create_web_php_fpm_pool_config code --- gvaweb/webtasks/tasks.py | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/gvaweb/webtasks/tasks.py b/gvaweb/webtasks/tasks.py index 61ddb66..bd2d28e 100644 --- a/gvaweb/webtasks/tasks.py +++ b/gvaweb/webtasks/tasks.py @@ -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