Copy file before creating a symlink

This commit is contained in:
VirtuBox
2019-08-30 10:49:55 +02:00
parent 27aa48ae7b
commit f7ee487901

View File

@@ -1263,6 +1263,8 @@ def removeAcmeConf(self, domain):
WOFileUtils.rm(self, '{0}'.format(sslforce)) WOFileUtils.rm(self, '{0}'.format(sslforce))
WOFileUtils.rm(self, '{0}.disabled' WOFileUtils.rm(self, '{0}.disabled'
.format(sslforce)) .format(sslforce))
WOFileUtils.rm(self, '/etc/letsencrypt/shared/{0}.conf'
.format(domain))
# find all broken symlinks # find all broken symlinks
sympath = "/var/www" sympath = "/var/www"
@@ -1503,8 +1505,16 @@ def copyWildcardCert(self, wo_domain_name, wo_root_domain):
if os.path.isfile("/var/www/{0}/conf/nginx/ssl.conf" if os.path.isfile("/var/www/{0}/conf/nginx/ssl.conf"
.format(wo_root_domain)): .format(wo_root_domain)):
try: try:
WOFileUtils.create_symlink(self, ["/var/www/{0}/conf/nginx/" if not os.path.isdir("/etc/letsencrypt/shared"):
"ssl.conf" WOFileUtils.mkdir(self, "/etc/letsencrypt/shared")
if not os.path.isfile("/etc/letsencrypt/shared/{0}.conf"
.format(wo_root_domain)):
WOFileUtils.copyfile("/var/www/{0}/conf/nginx/ssl.conf"
.format(wo_root_domain),
"/etc/letsencrypt/shared/{0}.conf"
.format(wo_root_domain))
WOFileUtils.create_symlink(self, ["/etc/letsencrypt/shared/"
"{0}.conf"
.format(wo_root_domain), .format(wo_root_domain),
'/var/www/{0}/conf/nginx/' '/var/www/{0}/conf/nginx/'
'ssl.conf' 'ssl.conf'