From bd1e9d68c58893ed9f8faa5a70f3ea0fb5fcfa92 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Thu, 25 Jul 2019 23:30:58 +0200 Subject: [PATCH] Add site_url_https to site --- wo/cli/plugins/site.py | 6 +++--- wo/core/variables.py | 16 +++++++--------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/wo/cli/plugins/site.py b/wo/cli/plugins/site.py index 3054133..2e57359 100644 --- a/wo/cli/plugins/site.py +++ b/wo/cli/plugins/site.py @@ -760,10 +760,10 @@ class WOSiteCreateController(CementBaseController): if self.app.pargs.hsts: setupHsts(self, wo_domain) + if not WOService.reload_service(self, 'nginx'): Log.error(self, "service nginx reload failed. " "check issues with `nginx -t` command") - Log.info(self, "Congratulations! Successfully Configured " "SSl for Site " " https://{0}".format(wo_domain)) @@ -773,7 +773,7 @@ class WOSiteCreateController(CementBaseController): msg="Adding letsencrypts config of site: {0}" .format(wo_domain)) updateSiteInfo(self, wo_domain, ssl=letsencrypt) - + site_url_https(self, wo_domain, wo_site_webroot) elif data['letsencrypt'] is False: Log.info(self, "Not using Let\'s encrypt for Site " " http://{0}".format(wo_domain)) @@ -1320,7 +1320,7 @@ class WOSiteUpdateController(CementBaseController): if not WOService.reload_service(self, 'nginx'): Log.error(self, "service nginx reload failed. " "check issues with `nginx -t` command") - + site_url_https(self, wo_domain, wo_site_webroot) Log.info(self, "Congratulations! Successfully " "Configured SSl for Site " " https://{0}".format(wo_domain)) diff --git a/wo/core/variables.py b/wo/core/variables.py index 750bf7f..6d027ef 100644 --- a/wo/core/variables.py +++ b/wo/core/variables.py @@ -3,7 +3,6 @@ import platform import socket import configparser import os -import psutil import datetime @@ -18,9 +17,7 @@ class WOVariables(): wo_phpmyadmin = "4.9.0.1" # Get WPCLI path - wo_wpcli_path = os.popen('command -v wp | tr "\n" " "').read() - if wo_wpcli_path == '': - wo_wpcli_path = '/usr/local/bin/wp ' + wo_wpcli_path = '/usr/local/bin/wp' # get wan network interface name wo_wan = os.popen("/sbin/ip -4 route get 8.8.8.8 | " @@ -33,10 +30,11 @@ class WOVariables(): wo_date = datetime.datetime.now().strftime('%d%b%Y%H%M%S') # WordOps core variables - wo_platform_distro = os.popen("lsb_release -si " + wo_platform_distro = os.popen("/usr/bin/lsb_release -si " "| tr -d \'\\n\'").read().lower() wo_platform_version = platform.linux_distribution()[1] - wo_platform_codename = os.popen("lsb_release -sc | tr -d \'\\n\'").read() + wo_platform_codename = os.popen( + "/usr/bin/lsb_release -sc | tr -d \'\\n\'").read() # Get timezone of system if os.path.isfile('/etc/timezone'): @@ -68,7 +66,7 @@ class WOVariables(): try: wo_user = config['user']['name'] wo_email = config['user']['email'] - except Exception as e: + except Exception: wo_user = input("Enter your name: ") wo_email = input("Enter your email: ") os.system("/usr/bin/git config --global user.name {0}".format(wo_user)) @@ -85,7 +83,7 @@ class WOVariables(): if [cnfpath] == config.read(cnfpath): try: wo_mysql_host = config.get('client', 'host') - except configparser.NoOptionError as e: + except configparser.NoOptionError: wo_mysql_host = "localhost" else: wo_mysql_host = "localhost" @@ -168,7 +166,7 @@ class WOVariables(): .format(codename=wo_platform_codename)) wo_mysql = ["mariadb-server", "percona-toolkit", "python3-mysqldb"] - wo_fail2ban = ["fail2ban", "python3-pyinotify"] + wo_fail2ban = ["fail2ban"] # Redis repo details if wo_platform_distro == 'ubuntu':