Fix stack_pref

This commit is contained in:
VirtuBox
2019-08-29 19:22:29 +02:00
parent 81b171943a
commit 29a290c935

View File

@@ -468,14 +468,14 @@ def post_pref(self, apt_packages, packages, upgrade=False):
"/var/www/22222/cert/22222.key;\n") "/var/www/22222/cert/22222.key;\n")
server_ip = requests.get('http://v4.wordops.eu') server_ip = requests.get('http://v4.wordops.eu')
WOTemplate.render(self, '/opt/cf-update.sh', if set(["nginx"]).issubset(set(apt_packages)):
'cf-update.mustache', print("WordOps backend configuration was successful\n"
data, overwrite=False) "You can access it on : https://{0}:22222"
WOFileUtils.chmod(self, "/opt/cf-update.sh", 0o775) .format(server_ip))
WOCron.setcron_weekly(self, '/opt/cf-update.sh ' print("HTTP Auth User Name: WordOps" +
'> /dev/null 2>&1', "\nHTTP Auth Password : {0}".format(passwd))
comment='Cloudflare IP refresh cronjob ' WOService.reload_service(self, 'nginx')
'added by WordOps') else:
self.msg = (self.msg + ["HTTP Auth User " self.msg = (self.msg + ["HTTP Auth User "
"Name: WordOps"] + "Name: WordOps"] +
["HTTP Auth Password : {0}" ["HTTP Auth Password : {0}"
@@ -486,6 +486,16 @@ def post_pref(self, apt_packages, packages, upgrade=False):
.format(server_ip.text, .format(server_ip.text,
WOVariables.wo_fqdn)]) 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: if upgrade:
try: try:
WOShellExec.cmd_exec(self, 'nginx -t') WOShellExec.cmd_exec(self, 'nginx -t')