Remove symlink directly

This commit is contained in:
VirtuBox
2019-08-30 10:17:31 +02:00
parent be0b0a832e
commit 27aa48ae7b
3 changed files with 4 additions and 16 deletions

View File

@@ -1470,15 +1470,8 @@ class WOSiteUpdateController(CementBaseController):
.format(wo_site_webroot))
# find all broken symlinks
sympath = "/var/www"
sslconf = ("{0}/conf/nginx/ssl.conf"
.format(wo_site_webroot))
symlinks = WOFileUtils.findBrokenSymlink(self, sympath)
WOFileUtils.findBrokenSymlink(self, sympath)
for symlink in symlinks:
wo_symlink = os.readlink('{0}'.format(symlink))
if wo_symlink == sslconf:
# remove broken symlinks
WOFileUtils.remove_symlink(self, symlink)
elif (pargs.letsencrypt == "clean" or
pargs.letsencrypt == "purge"):
removeAcmeConf(self, wo_domain)

View File

@@ -1266,13 +1266,8 @@ def removeAcmeConf(self, domain):
# find all broken symlinks
sympath = "/var/www"
symlinks = WOFileUtils.findBrokenSymlink(self, sympath)
WOFileUtils.findBrokenSymlink(self, sympath)
for symlink in symlinks:
wo_symlink = os.readlink('{0}'.format(symlink))
if wo_symlink == sslconf:
# remove broken symlinks
WOFileUtils.remove_symlink(self, symlink)
else:
if os.path.islink("{0}".format(sslconf)):
WOFileUtils.remove_symlink(self, "{0}".format(sslconf))

View File

@@ -302,10 +302,10 @@ class WOFileUtils():
if not os.path.exists(target_path):
links.append(path)
broken.append(path)
os.remove(path)
else:
links.append(path)
else:
# If it's not a symlink we're not interested.
continue
return broken
return True