Updating logging

This commit is contained in:
VirtuBox
2019-09-05 12:31:34 +02:00
parent 93ef756cb1
commit 4dfdf92d2d
3 changed files with 31 additions and 27 deletions

View File

@@ -50,7 +50,7 @@ class Log:
"""
Logs info messages with validation step
"""
space_to_add = int(40 - len(msg[0:40]))
space_to_add = int(30 - len(msg[0:30]))
space = " "
print(
Log.OKBLUE + "{0}".format(msg[0:30]) +
@@ -63,10 +63,10 @@ class Log:
"""
Logs info messages after validation step
"""
space_to_add = int(40 - len(msg[0:40]))
space_to_add = int(30 - len(msg[0:30]))
space = " "
print(
Log.OKBLUE + "{0}".format(msg[0:40]) +
Log.OKBLUE + "{0}".format(msg[0:30]) +
"{0}".format(space[0:space_to_add]) +
" [" + Log.ENDC + Log.OKGREEN + "OK" +
Log.ENDC + Log.OKBLUE + "]" + Log.ENDC, end=end)
@@ -77,10 +77,10 @@ class Log:
"""
Logs info messages after validation step
"""
space_to_add = int(40 - len(msg[0:40]))
space_to_add = int(30 - len(msg[0:30]))
space = " "
print(
Log.OKBLUE + "{0}".format(msg[0:40]) +
Log.OKBLUE + "{0}".format(msg[0:30]) +
"{0}".format(space[0:space_to_add]) +
" [" + Log.ENDC + Log.FAIL + "OK" +
Log.ENDC + Log.OKBLUE + "]" + Log.ENDC, end=end)

View File

@@ -68,22 +68,26 @@ class SSL:
"--allow-root --quiet"))
test_url = re.split(":", wo_siteurl)
if not (test_url[0] == 'https'):
WOShellExec.cmd_exec(
self, "{0} option update siteurl "
"\'https://{1}\' --allow-root".format(
WOVariables.wo_wpcli_path, domain))
WOShellExec.cmd_exec(
self, "{0} option update home "
"\'https://{1}\' --allow-root".format(
WOVariables.wo_wpcli_path, domain))
WOShellExec.cmd_exec(
self, "{0} search-replace \'http://{0}\'"
"\'https://{0}\' --skip-columns=guid "
"--skip-tables=wp_users"
.format(domain))
Log.info(
self, "Site address updated "
"successfully to https://{0}".format(domain))
Log.wait(self, "Updating site url with https")
try:
WOShellExec.cmd_exec(
self, "{0} option update siteurl "
"\'https://{1}\' --allow-root".format(
WOVariables.wo_wpcli_path, domain))
WOShellExec.cmd_exec(
self, "{0} option update home "
"\'https://{1}\' --allow-root".format(
WOVariables.wo_wpcli_path, domain))
WOShellExec.cmd_exec(
self, "{0} search-replace \'http://{0}\'"
"\'https://{0}\' --skip-columns=guid "
"--skip-tables=wp_users"
.format(domain))
except Exception as e:
Log.debug(self, str(e))
Log.failed(self, "Updating site url with https")
else:
Log.valide(self, "Updating site url with https")
# check if a wildcard exist to secure a new subdomain