Remove symlink directly
This commit is contained in:
@@ -1470,15 +1470,8 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
.format(wo_site_webroot))
|
.format(wo_site_webroot))
|
||||||
# find all broken symlinks
|
# find all broken symlinks
|
||||||
sympath = "/var/www"
|
sympath = "/var/www"
|
||||||
sslconf = ("{0}/conf/nginx/ssl.conf"
|
WOFileUtils.findBrokenSymlink(self, sympath)
|
||||||
.format(wo_site_webroot))
|
|
||||||
symlinks = 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
|
elif (pargs.letsencrypt == "clean" or
|
||||||
pargs.letsencrypt == "purge"):
|
pargs.letsencrypt == "purge"):
|
||||||
removeAcmeConf(self, wo_domain)
|
removeAcmeConf(self, wo_domain)
|
||||||
|
|||||||
@@ -1266,13 +1266,8 @@ def removeAcmeConf(self, domain):
|
|||||||
|
|
||||||
# find all broken symlinks
|
# find all broken symlinks
|
||||||
sympath = "/var/www"
|
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:
|
else:
|
||||||
if os.path.islink("{0}".format(sslconf)):
|
if os.path.islink("{0}".format(sslconf)):
|
||||||
WOFileUtils.remove_symlink(self, "{0}".format(sslconf))
|
WOFileUtils.remove_symlink(self, "{0}".format(sslconf))
|
||||||
|
|||||||
@@ -302,10 +302,10 @@ class WOFileUtils():
|
|||||||
if not os.path.exists(target_path):
|
if not os.path.exists(target_path):
|
||||||
links.append(path)
|
links.append(path)
|
||||||
broken.append(path)
|
broken.append(path)
|
||||||
|
os.remove(path)
|
||||||
else:
|
else:
|
||||||
links.append(path)
|
links.append(path)
|
||||||
else:
|
else:
|
||||||
# If it's not a symlink we're not interested.
|
# If it's not a symlink we're not interested.
|
||||||
continue
|
continue
|
||||||
|
return True
|
||||||
return broken
|
|
||||||
|
|||||||
Reference in New Issue
Block a user