prevent crashes of server uninstall check caused by failed LDAP connections

https://fedorahosted.org/freeipa/ticket/5409

Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
Martin Babinsky 2015-12-04 20:29:18 +01:00 committed by Martin Basti
parent 5c9b9089b7
commit 4cc206b0f8

View File

@ -1091,6 +1091,8 @@ def uninstall_check(installer):
realm=api.env.realm
)
conn.do_external_bind(pwd.getpwuid(os.geteuid()).pw_name)
api.Backend.ldap2.connect(autobind=True)
domain_level = dsinstance.get_domain_level(api)
except Exception:
msg = ("\nWARNING: Failed to connect to Directory Server to find "
"information about replication agreements. Uninstallation "
@ -1098,9 +1100,7 @@ def uninstall_check(installer):
"agreements.\n\n")
print(textwrap.fill(msg, width=80, replace_whitespace=False))
else:
api.Backend.ldap2.connect(autobind=True)
dns.uninstall_check(options)
domain_level = dsinstance.get_domain_level(api)
if domain_level == constants.DOMAIN_LEVEL_0:
rm = replication.ReplicationManager(