diff options
author | Ana Krivokapic <akrivoka@redhat.com> | 2013-08-29 17:44:02 +0200 |
---|---|---|
committer | Petr Viktorin <pviktori@redhat.com> | 2013-09-04 11:07:32 +0200 |
commit | 7959f3ee1e38ce10e2f32a51c3fa0f45f949f06f (patch) | |
tree | 01fe883433c719331794f8c30cfafba72d15255d /install | |
parent | de7b1f86dc5bc120e570a99e722a06865cad3fdd (diff) | |
download | freeipa.git-7959f3ee1e38ce10e2f32a51c3fa0f45f949f06f.tar.gz freeipa.git-7959f3ee1e38ce10e2f32a51c3fa0f45f949f06f.tar.xz freeipa.git-7959f3ee1e38ce10e2f32a51c3fa0f45f949f06f.zip |
Add warning when uninstalling active replica
Add a warning when trying to uninstall a replica that has active replication
agreements.
https://fedorahosted.org/freeipa/ticket/3867
Diffstat (limited to 'install')
-rwxr-xr-x | install/tools/ipa-server-install | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/install/tools/ipa-server-install b/install/tools/ipa-server-install index bfdef82a..1bf932da 100755 --- a/install/tools/ipa-server-install +++ b/install/tools/ipa-server-install @@ -28,18 +28,17 @@ import sys import os -import errno import grp -import subprocess import signal import shutil -import glob import pickle import random import tempfile import nss.error import base64 -from optparse import OptionGroup, OptionValueError, SUPPRESS_HELP +import pwd +import textwrap +from optparse import OptionGroup, OptionValueError from ipaserver.install import dsinstance from ipaserver.install import krbinstance @@ -51,10 +50,11 @@ from ipaserver.install import cainstance from ipaserver.install import memcacheinstance from ipaserver.install import otpdinstance from ipaserver.install import sysupgrade - +from ipaserver.install import replication from ipaserver.install import service, installutils from ipapython import version from ipapython import certmonger +from ipapython import ipaldap from ipaserver.install.installutils import * from ipaserver.plugins.ldap2 import ldap2 @@ -624,6 +624,32 @@ 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) + ) + 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() if options.external_ca: |