From c6904241d60e8e8a030584d4100c65b8a2fdfb76 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Mon, 19 Aug 2019 18:32:17 +0200 Subject: [PATCH] Add WOTemplate for nginx.conf --- wo/cli/plugins/stack_pref.py | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/wo/cli/plugins/stack_pref.py b/wo/cli/plugins/stack_pref.py index 7bf2f29..b8290b9 100644 --- a/wo/cli/plugins/stack_pref.py +++ b/wo/cli/plugins/stack_pref.py @@ -150,19 +150,14 @@ def post_pref(self, apt_packages, packages): ngxcnf = '/etc/nginx/conf.d' ngxcom = '/etc/nginx/common' ngxroot = '/var/www/' - if os.path.isfile('/etc/nginx/nginx.conf'): - if (WOVariables.wo_distro == 'ubuntu' or - WOVariables.wo_platform_codename == 'buster'): - data = dict(tls13=True) - else: - data = dict(tls13=False) - Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/nginx.conf') - wo_nginx = open('/etc/nginx/nginx.conf', - encoding='utf-8', mode='w') - self.app.render( - (data), 'nginx-core.mustache', out=wo_nginx) - wo_nginx.close() + if (WOVariables.wo_distro == 'ubuntu' or + WOVariables.wo_platform_codename == 'buster'): + data = dict(tls13=True) + else: + data = dict(tls13=False) + WOTemplate.tmpl_render(self, + '/etc/nginx/nginx.conf', + 'nginx-core.mustache', data) if not os.path.isfile('{0}/gzip.conf.disabled'.format(ngxcnf)): data = dict()