From 29a290c9354f54e236e96435ebfaafc6e62201a4 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Thu, 29 Aug 2019 19:22:29 +0200 Subject: [PATCH] Fix stack_pref --- wo/cli/plugins/stack_pref.py | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/wo/cli/plugins/stack_pref.py b/wo/cli/plugins/stack_pref.py index cc3e101..1d82b1c 100644 --- a/wo/cli/plugins/stack_pref.py +++ b/wo/cli/plugins/stack_pref.py @@ -468,14 +468,14 @@ def post_pref(self, apt_packages, packages, upgrade=False): "/var/www/22222/cert/22222.key;\n") server_ip = requests.get('http://v4.wordops.eu') - WOTemplate.render(self, '/opt/cf-update.sh', - 'cf-update.mustache', - data, overwrite=False) - WOFileUtils.chmod(self, "/opt/cf-update.sh", 0o775) - WOCron.setcron_weekly(self, '/opt/cf-update.sh ' - '> /dev/null 2>&1', - comment='Cloudflare IP refresh cronjob ' - 'added by WordOps') + if set(["nginx"]).issubset(set(apt_packages)): + print("WordOps backend configuration was successful\n" + "You can access it on : https://{0}:22222" + .format(server_ip)) + print("HTTP Auth User Name: WordOps" + + "\nHTTP Auth Password : {0}".format(passwd)) + WOService.reload_service(self, 'nginx') + else: self.msg = (self.msg + ["HTTP Auth User " "Name: WordOps"] + ["HTTP Auth Password : {0}" @@ -486,6 +486,16 @@ def post_pref(self, apt_packages, packages, upgrade=False): .format(server_ip.text, WOVariables.wo_fqdn)]) + if not os.path.isfile("/opt/cf-update.sh"): + WOTemplate.render(self, '/opt/cf-update.sh', + 'cf-update.mustache', + data, overwrite=False) + WOFileUtils.chmod(self, "/opt/cf-update.sh", 0o775) + WOCron.setcron_weekly(self, '/opt/cf-update.sh ' + '> /dev/null 2>&1', + comment='Cloudflare IP refresh cronjob ' + 'added by WordOps') + if upgrade: try: WOShellExec.cmd_exec(self, 'nginx -t')