Fix removal of ipa-kdc-proxy.conf symlink

installutils.remove_file() ignored broken symlinks. Now it uses
os.path.lexists() to detect and also remove dangling symlinks.

Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
This commit is contained in:
Christian Heimes 2015-06-29 10:45:15 +02:00 committed by Petr Vobornik
parent 5e92c981b0
commit 2842a83568
2 changed files with 2 additions and 2 deletions

View File

@ -481,8 +481,8 @@ class HTTPInstance(service.Service):
installutils.remove_file(paths.HTTPD_IPA_REWRITE_CONF)
installutils.remove_file(paths.HTTPD_IPA_CONF)
installutils.remove_file(paths.HTTPD_IPA_PKI_PROXY_CONF)
installutils.remove_file(paths.HTTPD_IPA_KDCPROXY_CONF)
installutils.remove_file(paths.HTTPD_IPA_KDCPROXY_CONF_SYMLINK)
installutils.remove_file(paths.HTTPD_IPA_KDCPROXY_CONF)
# Restore SELinux boolean states
boolean_states = {name: self.restore_state(name)

View File

@ -657,7 +657,7 @@ def remove_file(filename):
Remove a file and log any exceptions raised.
"""
try:
if os.path.exists(filename):
if os.path.lexists(filename):
os.unlink(filename)
except Exception, e:
root_logger.error('Error removing %s: %s' % (filename, str(e)))