diff --git a/wo/core/domainvalidate.py b/wo/core/domainvalidate.py index 50ab1dc..80afb0f 100644 --- a/wo/core/domainvalidate.py +++ b/wo/core/domainvalidate.py @@ -37,16 +37,17 @@ class WODomain(): if os.path.isfile("/var/lib/wo/public_suffix_list.dat"): # Read mode opens a file for reading only. suffix_file = open( - "/var/lib/wo/public_suffix_list.dat", encoding='utf-8', ) + "/var/lib/wo/public_suffix_list.dat", encoding='utf-8') # Read all the lines into a list. for domain_suffix in suffix_file: if (str(domain_suffix).strip()) == ('.'.join(domain_name[1:])): domain_type = 'domain' - root_domain = ('.'.join(domain_name[0:])) break else: domain_type = 'subdomain' - root_domain = ('.'.join(domain_name[1:])) suffix_file.close() - return (domain_type, root_domain) - return ('other', domain) + if domain_type == 'domain': + root_domain = ('.'.join(domain_name[0:])) + else: + root_domain = ('.'.join(domain_name[1:])) + return (domain_type, root_domain) diff --git a/wo/core/shellexec.py b/wo/core/shellexec.py index 979affb..61b12ea 100644 --- a/wo/core/shellexec.py +++ b/wo/core/shellexec.py @@ -23,9 +23,9 @@ class WOShellExec(): stderr=subprocess.PIPE, shell=True) as proc: (cmd_stdout_bytes, cmd_stderr_bytes) = proc.communicate() (cmd_stdout, cmd_stderr) = (cmd_stdout_bytes.decode('utf-8', - "replace"), + "replace"), cmd_stderr_bytes.decode('utf-8', - "replace")) + "replace")) if proc.returncode == 0: Log.debug(self, "Command Output: {0}, \nCommand Error: {1}" @@ -60,9 +60,9 @@ class WOShellExec(): stderr=subprocess.PIPE, shell=True) as proc: (cmd_stdout_bytes, cmd_stderr_bytes) = proc.communicate() (cmd_stdout, cmd_stderr) = (cmd_stdout_bytes.decode('utf-8', - "replace"), + "replace"), cmd_stderr_bytes.decode('utf-8', - "replace")) + "replace")) if proc.returncode == 0: Log.debug(self, "Command Output: {0}, \nCommand Error: {1}" diff --git a/wo/core/template.py b/wo/core/template.py index 93ee44c..cfbce0b 100644 --- a/wo/core/template.py +++ b/wo/core/template.py @@ -8,7 +8,7 @@ Render Templates """ -class WOTemplate(): +class WOTemplate: """WordOps template utilities""" def deploy(self, fileconf, template, data, overwrite=True): diff --git a/wo/core/variables.py b/wo/core/variables.py index a2d4a2e..16729d9 100644 --- a/wo/core/variables.py +++ b/wo/core/variables.py @@ -140,21 +140,20 @@ class WOVar(): wo_php_extra = ["php-memcached", "php-imagick", "graphviz", "php-xdebug", "php-msgpack", "php-redis"] - if not wo_distro == 'raspbian': - if (not wo_platform_codename == 'jessie'): - wo_mysql = ["mariadb-server", "percona-toolkit", - "python3-mysqldb", "mariadb-backup"] + wo_mysql = ["mariadb-server", "percona-toolkit"] + if wo_distro == 'raspbian': + wo_mysql = wo_mysql + ["python3-mysqldb"] + else: + if wo_platform_codename == 'jessie': + wo_mysql = wo_mysql + ["python3-mysql.connector"] else: - wo_mysql = ["mariadb-server", "percona-toolkit", - "python3-mysql.connector"] - else: - wo_mysql = ["mariadb-server", "percona-toolkit", - "python3-mysqldb"] + wo_mysql = wo_mysql + ["python3-mysqldb", "mariadb-backup"] + wo_mysql_client = ["mariadb-client"] if wo_platform_codename == 'jessie': - wo_mysql_client = ["mariadb-client", "python3-mysqldb"] + wo_mysql_client = wo_mysql_client + ["python3-mysqldb"] else: - wo_mysql_client = ["mariadb-client", "python3-mysql.connector"] + wo_mysql_client = wo_mysql_client + ["python3-mysql.connector"] wo_fail2ban = ["fail2ban"] wo_clamav = ["clamav", "clamav-freshclam"]