Fix handling of manually removed configuration files

This commit is contained in:
Jan Dittberner 2019-09-07 14:34:59 +02:00
parent 2d2c0adad7
commit 51ac479dac

View file

@ -81,6 +81,7 @@ def create_web_vhost_config(username, sitename, wildcard):
domain=sitename, user=username,
docroot=_build_document_root_path(sitename, username),
wildcard=wildcard)
conffile = None
try:
nginxtemp, filename = mkstemp()
conffile = os.fdopen(nginxtemp, 'w')
@ -162,7 +163,7 @@ def delete_web_vhost_config(sitename):
"""
try:
subprocess.check_output([
SUDO_CMD, RM_CMD, _build_vhost_config_path(sitename)],
SUDO_CMD, RM_CMD, "-f", _build_vhost_config_path(sitename)],
stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as cpe:
log_and_raise(
@ -182,6 +183,7 @@ def create_web_php_fpm_pool_config(username):
"""
conftmpl = _get_template('fpmpool.conf')
confdata = conftmpl.render(user=username)
conffile = None
try:
fpmtemp, filename = mkstemp()
conffile = os.fdopen(fpmtemp, 'w')
@ -216,7 +218,7 @@ def delete_web_php_fpm_pool_config(username):
"""
try:
subprocess.check_output([
SUDO_CMD, RM_CMD, _build_php_fpm_pool_file(username)],
SUDO_CMD, RM_CMD, "-f", _build_php_fpm_pool_file(username)],
stderr=subprocess.STDOUT)
subprocess.check_output([
SUDO_CMD, SERVICE_CMD, 'php5-fpm', 'reload'],