Updating logging
This commit is contained in:
@@ -1354,7 +1354,7 @@ def setupLetsEncrypt(self, wo_domain_name, subdomain=False, wildcard=False,
|
||||
if subdomain:
|
||||
Log.info(self, "Certificate type: Subdomain")
|
||||
Log.info(self, "Validation mode : {0}".format(validation_mode))
|
||||
Log.wait(self, "Issuing SSL certificate with acme.sh")
|
||||
Log.wait(self, "Issuing SSL cert with acme.sh")
|
||||
ssl = WOShellExec.cmd_exec(self, "{0} ".format(wo_acme_exec) +
|
||||
"--issue "
|
||||
"-d {0} {1} "
|
||||
@@ -1365,7 +1365,7 @@ def setupLetsEncrypt(self, wo_domain_name, subdomain=False, wildcard=False,
|
||||
elif wildcard:
|
||||
Log.info(self, "Certificate type: Wildcard")
|
||||
Log.info(self, "Validation mode : {0}".format(validation_mode))
|
||||
Log.wait(self, "Issuing SSL certificate with acme.sh")
|
||||
Log.wait(self, "Issuing SSL cert with acme.sh")
|
||||
ssl = WOShellExec.cmd_exec(self, "{0} ".format(wo_acme_exec) +
|
||||
"--issue "
|
||||
"-d {0} -d '*.{0}' --dns {1} "
|
||||
@@ -1376,7 +1376,7 @@ def setupLetsEncrypt(self, wo_domain_name, subdomain=False, wildcard=False,
|
||||
else:
|
||||
Log.info(self, "Certificate type: Domain + www")
|
||||
Log.info(self, "Validation mode : {0}".format(validation_mode))
|
||||
Log.wait(self, "Issuing SSL certificate with acme.sh")
|
||||
Log.wait(self, "Issuing SSL cert with acme.sh")
|
||||
ssl = WOShellExec.cmd_exec(self, "{0} ".format(wo_acme_exec) +
|
||||
"--issue "
|
||||
"-d {0} -d www.{0} {1} "
|
||||
@@ -1384,7 +1384,7 @@ def setupLetsEncrypt(self, wo_domain_name, subdomain=False, wildcard=False,
|
||||
.format(wo_domain_name,
|
||||
acme_mode, keylenght))
|
||||
if ssl:
|
||||
Log.valide(self, "Issuing SSL certificate with acme.sh")
|
||||
Log.valide(self, "Issuing SSL cert with acme.sh")
|
||||
Log.wait(self, "Deploying SSL cert with acme.sh")
|
||||
Log.debug(self, "Cert deployment for domain: {0}"
|
||||
.format(wo_domain_name))
|
||||
@@ -1582,8 +1582,8 @@ def httpsRedirect(self, wo_domain_name, redirect=True, wildcard=False):
|
||||
"\tlisten [::]:80;\n" +
|
||||
"\tserver_name www.{0} {0};\n"
|
||||
.format(wo_domain_name) +
|
||||
"\treturn 301 https://{0}"
|
||||
.format(wo_domain_name)+"$request_uri;\n}")
|
||||
"\treturn 301 https://$host"
|
||||
"$request_uri;\n}")
|
||||
sslconf.close()
|
||||
|
||||
except IOError as e:
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user