From c2d27f1480be211657f9d2f3c9b71633ac0ff321 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Mon, 28 Oct 2019 09:22:04 +0100 Subject: [PATCH] Fix small issues detected by codacy --- wo/cli/plugins/debug.py | 5 ++--- wo/cli/plugins/site.py | 3 +-- wo/core/acme.py | 5 ++--- wo/core/domainvalidate.py | 3 +-- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/wo/cli/plugins/debug.py b/wo/cli/plugins/debug.py index 1cb171e..ed38c5d 100644 --- a/wo/cli/plugins/debug.py +++ b/wo/cli/plugins/debug.py @@ -14,7 +14,7 @@ from wo.core.fileutils import WOFileUtils from wo.core.logging import Log from wo.core.mysql import WOMysql from wo.core.services import WOService -from wo.core.shellexec import WOShellExec +from wo.core.shellexec import WOShellExec, CommandExecutionError from wo.core.variables import WOVar @@ -703,8 +703,7 @@ class WODebugController(CementBaseController): "-l | sed '/WordOps " "start MySQL slow " "log/,+2d'" - "| crontab -\"" - .format(cron_time)): + "| crontab -\""): Log.error(self, "failed to remove crontab entry") except CommandExecutionError as e: Log.debug(self, str(e)) diff --git a/wo/cli/plugins/site.py b/wo/cli/plugins/site.py index 344d0ea..0319a6d 100644 --- a/wo/cli/plugins/site.py +++ b/wo/cli/plugins/site.py @@ -227,8 +227,7 @@ class WOSiteController(CementBaseController): Log.info(self, Log.ENDC + text) f.close() else: - Log.error(self, "nginx configuration file does not exists" - .format(wo_domain)) + Log.error(self, "nginx configuration file does not exists") @expose(help="Change directory to site webroot") def cd(self): diff --git a/wo/core/acme.py b/wo/core/acme.py index 444041e..eccaaf5 100644 --- a/wo/core/acme.py +++ b/wo/core/acme.py @@ -148,9 +148,8 @@ class WOAcme: self, "You have to set the " "proper DNS record for your domain", False) return False - else: - Log.debug(self, "DNS record are properly set") - return True + Log.debug(self, "DNS record are properly set") + return True def cert_check(self, wo_domain_name): """Check certificate existance with acme.sh and return Boolean""" diff --git a/wo/core/domainvalidate.py b/wo/core/domainvalidate.py index 0db491d..e84a26b 100644 --- a/wo/core/domainvalidate.py +++ b/wo/core/domainvalidate.py @@ -2,7 +2,7 @@ import os -class WODomain(): +class WODomain: """WordOps domain validation utilities""" def validate(self, url): @@ -24,7 +24,6 @@ class WODomain(): return final_domain return domain_name - def getlevel(self, domain): """ Returns the domain type : domain, subdomain and the root domain