Hello, This patch fixes the regression introduced by the original fix for ticket #3867.
https://fedorahosted.org/freeipa/ticket/3867 -- Regards, Ana Krivokapic Associate Software Engineer FreeIPA team Red Hat Inc.
From 0ad82d43314ef7e8d9538de76b118ce0922e512d Mon Sep 17 00:00:00 2001 From: Ana Krivokapic <[email protected]> Date: Fri, 6 Sep 2013 14:53:01 +0200 Subject: [PATCH] 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 --- install/tools/ipa-server-install | 64 +++++++++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 23 deletions(-) mode change 100755 => 100644 install/tools/ipa-server-install diff --git a/install/tools/ipa-server-install b/install/tools/ipa-server-install old mode 100755 new mode 100644 index 1bf932da731965b342c0c49d39e6a175bf98705b..f46e4b0548998dd5b0c8a12321ba8916ccb40f25 --- 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 dispite 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() -- 1.8.3.1
_______________________________________________ Freeipa-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/freeipa-devel
