Improve logging and fix typo

This commit is contained in:
VirtuBox
2019-09-04 04:21:07 +02:00
parent ce2c63bd64
commit 99a2206a76
4 changed files with 24 additions and 12 deletions

View File

@@ -1387,7 +1387,7 @@ class WOSiteUpdateController(CementBaseController):
.format(wo_domain))
httpsRedirect(self, wo_domain, True, wo_wildcard)
SSL.siteUrlHttps(self, wo_domain)
SSL.siteurlhttps(self, wo_domain)
if not WOService.reload_service(self, 'nginx'):
Log.error(self, "service nginx reload failed. "

View File

@@ -484,11 +484,15 @@ class WOStackController(CementBaseController):
# wo_mem = int(memsplit[0])
# if (wo_mem < 4000000):
# WOSwap.add(self)
Log.info(self, "Updating apt-cache, please wait...")
Log.wait(self, "Updating apt-cache ")
WOAptGet.update(self)
Log.info(self, "Installing packages, please wait...")
Log.valide(self, "Updating apt-cache ")
Log.info(self, "Installing APT packages ")
WOAptGet.install(self, apt_packages)
Log.valide(self, "Installing APT packages ")
Log.wait(self, "Configuring APT packages ")
post_pref(self, apt_packages, empty_packages)
Log.valide(self, "Configuring APT packages ")
if (packages):
Log.debug(self, "Downloading following: {0}".format(packages))
WODownload.download(self, packages)
@@ -714,9 +718,10 @@ class WOStackController(CementBaseController):
if (apt_packages):
Log.debug(self, "Removing apt_packages")
Log.info(self, "Removing apt packages, please wait...")
Log.wait(self, "Removing APT packages ")
WOAptGet.remove(self, apt_packages)
WOAptGet.auto_remove(self)
Log.valide(self, "Removing APT packages ")
Log.info(self, "Successfully removed packages")
@@ -934,9 +939,10 @@ class WOStackController(CementBaseController):
"uninstaller.sh -y -f")
if (apt_packages):
Log.info(self, "Purging apt packages, please wait...")
Log.wait(self, "Purging APT Packages ")
WOAptGet.remove(self, apt_packages, purge=True)
WOAptGet.auto_remove(self)
Log.valide(self, "Purging APT Packages ")
if (packages):
Log.info(self, "Purging packages, please wait...")

View File

@@ -87,8 +87,6 @@ class WOStackUpgradeController(CementBaseController):
if pargs.web:
if WOAptGet.is_installed(self, 'nginx-custom'):
pargs.nginx = True
else:
Log.info(self, "Nginx is not already installed")
pargs.php = True
pargs.mysql = True
pargs.wpcli = True
@@ -204,8 +202,12 @@ class WOStackUpgradeController(CementBaseController):
'/etc/apt/preferences.d/nginx-block'):
WOAptGet.install(self, nginx_packages)
Log.wait(self, "Upgrading APT Packages ")
WOAptGet.install(self, apt_packages)
Log.valide(self, "Upgrading APT Packages ")
Log.wait(self, "Configuring APT Packages ")
post_pref(self, nginx_packages, [], True)
Log.valide(self, "Configuring APT Packages ")
post_pref(self, apt_packages, [], True)
# Post Actions after package updates
@@ -226,7 +228,7 @@ class WOStackUpgradeController(CementBaseController):
WOFileUtils.chmod(self, "/usr/local/bin/wp", 0o775)
if pargs.netdata:
Log.info(self, "Upgrading Netdata, please wait...")
Log.wait(self, "Upgrading Netdata ")
if os.path.isdir('/opt/netdata'):
WOShellExec.cmd_exec(
self, "bash /opt/netdata/usr/"
@@ -237,6 +239,7 @@ class WOStackUpgradeController(CementBaseController):
self, "bash /usr/"
"libexec/netdata/netdata-"
"updater.sh")
Log.valide(self, "Upgrading Netdata ")
if pargs.dashboard:
Log.debug(self, "Extracting wo-dashboard.tar.gz "
@@ -252,16 +255,17 @@ class WOStackUpgradeController(CementBaseController):
WOVariables.wo_php_user, recursive=True)
if pargs.composer:
Log.info(self, "Upgrading Composer, please wait...")
Log.wait(self, "Upgrading Composer ")
WOShellExec.cmd_exec(self, "php -q /var/lib/wo"
"/tmp/composer-install "
"--install-dir=/var/lib/wo/tmp/")
shutil.copyfile('/var/lib/wo/tmp/composer.phar',
'/usr/local/bin/composer')
WOFileUtils.chmod(self, "/usr/local/bin/composer", 0o775)
Log.valide(self, "Upgrading Composer ")
if pargs.phpmyadmin:
Log.info(self, "Upgrading phpMyAdmin, please wait...")
Log.wait(self, "Upgrading phpMyAdmin ")
WOExtract.extract(self, '/var/lib/wo/tmp/pma.tar.gz',
'/var/lib/wo/tmp/')
shutil.copyfile(('{0}22222/htdocs/db/pma'
@@ -282,6 +286,7 @@ class WOStackUpgradeController(CementBaseController):
.format(WOVariables.wo_webroot),
WOVariables.wo_php_user,
WOVariables.wo_php_user, recursive=True)
Log.valide(self, "Upgrading phpMyAdmin ")
Log.info(self, "Successfully updated packages")
else:

View File

@@ -52,7 +52,7 @@ class Log:
"""
print(
Log.OKBLUE + msg +
"[" + Log.ENDC + ".." + Log.OKBLUE + "]", end=end)
" [" + Log.ENDC + ".." + Log.OKBLUE + "]", end=end)
if log:
self.app.log.info(Log.OKBLUE + msg + Log.ENDC)
@@ -62,6 +62,7 @@ class Log:
"""
print(
Log.OKBLUE + msg +
"[" + Log.ENDC + "OK" + Log.OKBLUE + "]", end=end)
" [" + Log.ENDC + Log.OKGREEN + "OK" +
Log.ENDC + Log.OKBLUE + "]", end=end)
if log:
self.app.log.info(Log.OKBLUE + msg + Log.ENDC)