Remove symlink directly
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user