diff options
author | Ana Krivokapic <akrivoka@redhat.com> | 2013-09-06 14:53:01 +0200 |
---|---|---|
committer | Petr Viktorin <pviktori@redhat.com> | 2013-09-09 17:24:04 +0200 |
commit | a70b08e9aea891555ebee512de196748a835acb8 (patch) | |
tree | b3274d964a71b6b912f1aacfe0264c7aaadb707b /install/tools/ipa-server-install | |
parent | 66242e6ab0ab21eb39f3fbdaa586e8e38663faae (diff) | |
download | freeipa-a70b08e9aea891555ebee512de196748a835acb8.tar.gz freeipa-a70b08e9aea891555ebee512de196748a835acb8.tar.xz freeipa-a70b08e9aea891555ebee512de196748a835acb8.zip |
Do not crash if DS is down during server uninstall
DS is contacted during server uninstallation, in order to obtain information
about replication agreements. If DS is unavailable, warn and continue with
uninstallation.
https://fedorahosted.org/freeipa/ticket/3867
Diffstat (limited to 'install/tools/ipa-server-install')
-rw-r--r--[-rwxr-xr-x] | install/tools/ipa-server-install | 64 |
1 files changed, 41 insertions, 23 deletions
diff --git a/install/tools/ipa-server-install b/install/tools/ipa-server-install index 1bf932da7..028cca097 100755..100644 --- a/install/tools/ipa-server-install +++ b/install/tools/ipa-server-install @@ -624,31 +624,49 @@ def main(): print "Aborting uninstall operation." sys.exit(1) - conn = ipaldap.IPAdmin(api.env.host, ldapi=True, realm=api.env.realm) - conn.do_external_bind(pwd.getpwuid(os.geteuid()).pw_name) - rm = replication.ReplicationManager(api.env.realm, api.env.host, None, - conn=conn) - agreements = rm.find_ipa_replication_agreements() - - if agreements: - other_masters = [a.get('cn')[0][4:] for a in agreements] - msg = ( - "\nReplication agreements with the following IPA masters " - "found: %s. Removing any replication agreements before " - "uninstalling the server is strongly recommended. You can " - "remove replication agreements by running the following " - "command on any other IPA master:\n" % ", ".join(other_masters) + try: + conn = ipaldap.IPAdmin( + api.env.host, + ldapi=True, + realm=api.env.realm ) - cmd = "$ ipa-replica-manage del %s\n" % api.env.host + conn.do_external_bind(pwd.getpwuid(os.geteuid()).pw_name) + except Exception: + msg = ("\nWARNING: Failed to connect to Directory Server to find " + "information about replication agreements. Uninstallation " + "will continue despite the possible existing replication " + "agreements.\n\n") print textwrap.fill(msg, width=80, replace_whitespace=False) - print cmd - if not (options.unattended or user_input("Are you sure you want " - "to continue with the " - "uninstall procedure?", - False)): - print "" - print "Aborting uninstall operation." - sys.exit(1) + else: + rm = replication.ReplicationManager( + realm=api.env.realm, + hostname=api.env.host, + dirman_passwd=None, + conn=conn + ) + agreements = rm.find_ipa_replication_agreements() + + if agreements: + other_masters = [a.get('cn')[0][4:] for a in agreements] + msg = ( + "\nReplication agreements with the following IPA masters " + "found: %s. Removing any replication agreements before " + "uninstalling the server is strongly recommended. You can " + "remove replication agreements by running the following " + "command on any other IPA master:\n" % ", ".join( + other_masters) + ) + cmd = "$ ipa-replica-manage del %s\n" % api.env.host + print textwrap.fill(msg, width=80, replace_whitespace=False) + print cmd + if not (options.unattended or user_input("Are you sure you " + "want to continue " + "with the uninstall " + "procedure?", + False)): + print "" + print "Aborting uninstall operation." + sys.exit(1) return uninstall() |