summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorAna Krivokapic <akrivoka@redhat.com>2013-08-29 17:44:02 +0200
committerPetr Viktorin <pviktori@redhat.com>2013-09-04 11:07:42 +0200
commit95d3d3d60b9e981bcd192ed11242d58873fd09bf (patch)
tree9d1c8b24a28f1a40ac2910a75ccaf653b194595c /install
parentbc559c0b386cf6e55df6e60d6dcfbc39cf68b85e (diff)
downloadfreeipa.git-95d3d3d60b9e981bcd192ed11242d58873fd09bf.tar.gz
freeipa.git-95d3d3d60b9e981bcd192ed11242d58873fd09bf.tar.xz
freeipa.git-95d3d3d60b9e981bcd192ed11242d58873fd09bf.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-xinstall/tools/ipa-server-install36
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: