Fix some errors with pylint

This commit is contained in:
VirtuBox
2019-09-30 12:38:28 +02:00
parent 6c3d645d9e
commit 905ef0660a
6 changed files with 22 additions and 16 deletions

View File

@@ -25,7 +25,7 @@ if not os.path.exists('/var/lib/wo/tmp/'):
os.makedirs('/var/lib/wo/tmp/') os.makedirs('/var/lib/wo/tmp/')
setup(name='wo', setup(name='wo',
version='3.9.9.1', version='3.9.9.2',
description=long_description, description=long_description,
long_description=long_description, long_description=long_description,
classifiers=[], classifiers=[],

View File

@@ -1051,6 +1051,7 @@ class WOSiteUpdateController(CementBaseController):
if not WOService.reload_service(self, 'nginx'): if not WOService.reload_service(self, 'nginx'):
Log.error(self, "service nginx reload failed. " Log.error(self, "service nginx reload failed. "
"check issues with `nginx -t` command") "check issues with `nginx -t` command")
return 0
if (pargs.ngxblocker and not (pargs.html or if (pargs.ngxblocker and not (pargs.html or
pargs.php or pargs.php73 or pargs.php or pargs.php73 or
@@ -1060,11 +1061,14 @@ class WOSiteUpdateController(CementBaseController):
pargs.wpsubdir or pargs.wpsubdomain or pargs.wpsubdir or pargs.wpsubdomain or
pargs.hsts)): pargs.hsts)):
if pargs.ngxblocker == "on": if pargs.ngxblocker == "on":
try: if os.path.isdir('/etc/nginx/bots.d'):
setupngxblocker(self, wo_domain) try:
except SiteError as e: setupngxblocker(self, wo_domain)
Log.debug(self, str(e)) except SiteError as e:
Log.info(self, "\nngxblocker not enabled.") Log.debug(self, str(e))
Log.info(self, "\nngxblocker not enabled.")
else:
Log.error(self, 'ngxblocker stack is not installed')
elif pargs.ngxblocker == "off": elif pargs.ngxblocker == "off":
if os.path.isfile( if os.path.isfile(
'/var/www/{0}/conf/nginx/ngxblocker.conf' '/var/www/{0}/conf/nginx/ngxblocker.conf'
@@ -1082,6 +1086,7 @@ class WOSiteUpdateController(CementBaseController):
if not WOService.reload_service(self, 'nginx'): if not WOService.reload_service(self, 'nginx'):
Log.error(self, "service nginx reload failed. " Log.error(self, "service nginx reload failed. "
"check issues with `nginx -t` command") "check issues with `nginx -t` command")
return 0
if ((stype == 'php' and if ((stype == 'php' and
oldsitetype not in ['html', 'proxy', 'php73']) or oldsitetype not in ['html', 'proxy', 'php73']) or

View File

@@ -17,7 +17,8 @@ from wo.core.aptget import WOAptGet
from wo.core.fileutils import WOFileUtils from wo.core.fileutils import WOFileUtils
from wo.core.git import WOGit from wo.core.git import WOGit
from wo.core.logging import Log from wo.core.logging import Log
from wo.core.mysql import WOMysql from wo.core.mysql import (MySQLConnectionError, StatementExcecutionError,
WOMysql)
from wo.core.services import WOService from wo.core.services import WOService
from wo.core.shellexec import CommandExecutionError, WOShellExec from wo.core.shellexec import CommandExecutionError, WOShellExec
from wo.core.sslutils import SSL from wo.core.sslutils import SSL

View File

@@ -13,11 +13,10 @@ class WOAcme:
"""Acme.sh utilities for WordOps""" """Acme.sh utilities for WordOps"""
def setupletsencrypt(self, acme_domains, acmedata): def setupletsencrypt(self, acme_domains, acmedata):
"""issue SSL certificates with acme.sh""" """Issue SSL certificates with acme.sh"""
all_domains = '\' -d \''.join(acme_domains) all_domains = '\' -d \''.join(acme_domains)
wo_acme_dns = acmedata['acme_dns'] wo_acme_dns = acmedata['acme_dns']
keylenght = "{0}".format(self.app.config.get('letsencrypt', keylenght = "{0}".format(WOVariables.wo_keylength)
'keylength'))
wo_acme_exec = ("/etc/letsencrypt/acme.sh --config-home " wo_acme_exec = ("/etc/letsencrypt/acme.sh --config-home "
"'/etc/letsencrypt/config'") "'/etc/letsencrypt/config'")
if acmedata['dns'] is True: if acmedata['dns'] is True:
@@ -96,8 +95,7 @@ class WOAcme:
if not WOFileUtils.grep(self, '/var/www/22222/conf/nginx/ssl.conf', if not WOFileUtils.grep(self, '/var/www/22222/conf/nginx/ssl.conf',
'/etc/letsencrypt'): '/etc/letsencrypt'):
Log.info(self, "Securing WordOps backend with current cert" Log.info(self, "Securing WordOps backend with current cert")
.format(wo_domain_name))
sslconf = open("/var/www/22222/conf/nginx/ssl.conf", sslconf = open("/var/www/22222/conf/nginx/ssl.conf",
encoding='utf-8', mode='w') encoding='utf-8', mode='w')
sslconf.write("ssl_certificate {0}/{1}/fullchain.pem;\n" sslconf.write("ssl_certificate {0}/{1}/fullchain.pem;\n"

View File

@@ -54,14 +54,14 @@ class WOMysql():
db=db_name, read_default_file='~/.my.cnf') db=db_name, read_default_file='~/.my.cnf')
return connection return connection
except pymysql.err.InternalError as e:
Log.debug(self, str(e))
raise MySQLConnectionError
except DatabaseError as e: except DatabaseError as e:
if e.args[1] == '#42000Unknown database \'{0}\''.format(db_name): if e.args[1] == '#42000Unknown database \'{0}\''.format(db_name):
raise DatabaseNotExistsError raise DatabaseNotExistsError
else: else:
raise MySQLConnectionError raise MySQLConnectionError
except pymysql.err.InternalError as e:
Log.debug(self, str(e))
raise MySQLConnectionError
except Exception as e: except Exception as e:
Log.debug(self, "[Error]Setting up database: \'" + str(e) + "\'") Log.debug(self, "[Error]Setting up database: \'" + str(e) + "\'")
raise MySQLConnectionError raise MySQLConnectionError

View File

@@ -111,6 +111,8 @@ class WOVariables():
wo_nginx = ["nginx-custom", "nginx-wo"] wo_nginx = ["nginx-custom", "nginx-wo"]
wo_nginx_key = '188C9FB063F0247A' wo_nginx_key = '188C9FB063F0247A'
wo_keylength = self.app.config.get('letsencrypt', 'keylength')
wo_php = ["php7.2-fpm", "php7.2-curl", "php7.2-gd", "php7.2-imap", wo_php = ["php7.2-fpm", "php7.2-curl", "php7.2-gd", "php7.2-imap",
"php7.2-readline", "php7.2-common", "php7.2-recode", "php7.2-readline", "php7.2-common", "php7.2-recode",
"php7.2-cli", "php7.2-mbstring", "php7.2-intl", "php7.2-cli", "php7.2-mbstring", "php7.2-intl",