Merge branch 'release/0.1.6' into production

* release/0.1.6:
  Bump version
  Update changelog
  Remove disfunctional create_web_php_fpm_pool_config code
This commit is contained in:
Jan Dittberner 2020-03-02 10:13:30 +01:00
commit 8f53d2a3eb
3 changed files with 11 additions and 21 deletions

View file

@ -1,6 +1,9 @@
Changelog
=========
* :release:`0.1.6 <2020-03-02>`
* :bug:`-` remove disfunctional code in create_web_php_fpm_pool_config
* :release:`0.1.5 <2020-02-29>`
* :bug:`-` fix path to systemctl
* :bug:`-` reduce template for nginx vhosts to the bare minimum to use

View file

@ -62,7 +62,7 @@ copyright = u'2015-2020, Jan Dittberner'
# The short X.Y version.
version = '0.1'
# The full version, including alpha/beta/rc tags.
release = '0.1.5'
release = '0.1.6'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.

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