Merge pull request #633 from WordOps/updating-configuration
Fix reported issues
This commit is contained in:
@@ -9,6 +9,7 @@ from wo.core.logging import Log
|
||||
from wo.core.shellexec import WOShellExec, CommandExecutionError
|
||||
from wo.core.variables import WOVar
|
||||
from wo.core.template import WOTemplate
|
||||
from wo.core.checkfqdn import WOFqdn
|
||||
|
||||
|
||||
class WOAcme:
|
||||
@@ -181,10 +182,10 @@ class WOAcme:
|
||||
|
||||
def check_dns(self, acme_domains):
|
||||
"""Check if a list of domains point to the server IP"""
|
||||
server_ip = requests.get('https://v4.wordops.eu/').text
|
||||
server_ip = WOFqdn.get_server_ip(self)
|
||||
for domain in acme_domains:
|
||||
domain_ip = requests.get('http://v4.wordops.eu/dns/{0}/'
|
||||
.format(domain)).text
|
||||
domain_ip = WOFqdn.get_domain_ip(self, domain)
|
||||
|
||||
if (not domain_ip == server_ip):
|
||||
Log.warn(
|
||||
self, "{0}".format(domain) +
|
||||
@@ -252,8 +253,7 @@ class WOAcme:
|
||||
for dir in acmedir:
|
||||
if os.path.exists('{0}'.format(dir)):
|
||||
WOFileUtils.rm(self, '{0}'.format(dir))
|
||||
# find all broken symlinks
|
||||
WOFileUtils.findBrokenSymlink(self, "/var/www")
|
||||
|
||||
else:
|
||||
if os.path.islink("{0}".format(sslconf)):
|
||||
WOFileUtils.remove_symlink(self, "{0}".format(sslconf))
|
||||
|
||||
@@ -4,33 +4,61 @@ from wo.core.shellexec import WOShellExec
|
||||
from wo.core.variables import WOVar
|
||||
|
||||
|
||||
def check_fqdn(self, wo_host):
|
||||
"""FQDN check with WordOps, for mail server hostname must be FQDN"""
|
||||
# wo_host=os.popen("hostname -f | tr -d '\n'").read()
|
||||
if '.' in wo_host:
|
||||
WOVar.wo_fqdn = wo_host
|
||||
with open('/etc/hostname', encoding='utf-8', mode='w') as hostfile:
|
||||
hostfile.write(wo_host)
|
||||
class WOFqdn:
|
||||
"""IP and FQDN tools for WordOps"""
|
||||
|
||||
def check_fqdn(self, wo_host):
|
||||
"""FQDN check with WordOps, for mail server hostname must be FQDN"""
|
||||
# wo_host=os.popen("hostname -f | tr -d '\n'").read()
|
||||
if '.' in wo_host:
|
||||
WOVar.wo_fqdn = wo_host
|
||||
with open('/etc/hostname', encoding='utf-8', mode='w') as hostfile:
|
||||
hostfile.write(wo_host)
|
||||
|
||||
WOShellExec.cmd_exec(self, "sed -i \"1i\\127.0.0.1 {0}\" /etc/hosts"
|
||||
.format(wo_host))
|
||||
if WOVar.wo_distro == 'debian':
|
||||
WOShellExec.cmd_exec(self, "/etc/init.d/hostname.sh start")
|
||||
else:
|
||||
WOShellExec.cmd_exec(self, "service hostname restart")
|
||||
|
||||
WOShellExec.cmd_exec(self, "sed -i \"1i\\127.0.0.1 {0}\" /etc/hosts"
|
||||
.format(wo_host))
|
||||
if WOVar.wo_distro == 'debian':
|
||||
WOShellExec.cmd_exec(self, "/etc/init.d/hostname.sh start")
|
||||
else:
|
||||
WOShellExec.cmd_exec(self, "service hostname restart")
|
||||
wo_host = input("Enter hostname [fqdn]:")
|
||||
WOFqdn.check_fqdn(self, wo_host)
|
||||
|
||||
else:
|
||||
wo_host = input("Enter hostname [fqdn]:")
|
||||
check_fqdn(self, wo_host)
|
||||
def check_fqdn_ip(self):
|
||||
"""Check if server hostname resolved server IP"""
|
||||
try:
|
||||
x = requests.get('http://v4.wordops.eu')
|
||||
ip = (x.text).strip()
|
||||
|
||||
wo_fqdn = WOVar.wo_fqdn
|
||||
y = requests.get('http://v4.wordops.eu/dns/{0}/'.format(wo_fqdn))
|
||||
ip_fqdn = (y.text).strip()
|
||||
|
||||
def check_fqdn_ip(self):
|
||||
"""Check if server hostname resolved server IP"""
|
||||
x = requests.get('http://v4.wordops.eu')
|
||||
ip = (x.text).strip()
|
||||
return bool(ip == ip_fqdn)
|
||||
except requests.exceptions.RequestException as e:
|
||||
print("Error occurred during request:", e)
|
||||
return False
|
||||
|
||||
wo_fqdn = WOVar.wo_fqdn
|
||||
y = requests.get('http://v4.wordops.eu/dns/{0}/'.format(wo_fqdn))
|
||||
ip_fqdn = (y.text).strip()
|
||||
def get_server_ip(self):
|
||||
"""Get the server externet IP"""
|
||||
try:
|
||||
x = requests.get('http://v4.wordops.eu')
|
||||
ip = (x.text).strip()
|
||||
|
||||
return bool(ip == ip_fqdn)
|
||||
return ip
|
||||
except requests.exceptions.RequestException as e:
|
||||
print("Error occurred during request:", e)
|
||||
return None
|
||||
|
||||
def get_domain_ip(self, wo_domain):
|
||||
"""Get the server externet IP"""
|
||||
try:
|
||||
y = requests.get('http://v4.wordops.eu/dns/{0}/'.format(wo_domain))
|
||||
domain_ip = (y.text).strip()
|
||||
|
||||
return domain_ip
|
||||
except requests.exceptions.RequestException as e:
|
||||
print("Error occurred during request:", e)
|
||||
return None
|
||||
|
||||
@@ -17,11 +17,11 @@ class WOVar():
|
||||
# WordOps version
|
||||
wo_version = "3.19.1"
|
||||
# WordOps packages versions
|
||||
wo_wp_cli = "2.9.0"
|
||||
wo_wp_cli = "2.10.0"
|
||||
wo_adminer = "4.8.1"
|
||||
wo_phpmyadmin = "5.2.0"
|
||||
wo_extplorer = "2.1.15"
|
||||
wo_dashboard = "1.2"
|
||||
wo_dashboard = "1.3"
|
||||
|
||||
# Get WPCLI path
|
||||
wo_wpcli_path = '/usr/local/bin/wp'
|
||||
|
||||
Reference in New Issue
Block a user