summaryrefslogtreecommitdiffstats
path: root/install/tools/ipa-replica-manage
diff options
context:
space:
mode:
authorAna Krivokapic <akrivoka@redhat.com>2013-01-24 11:13:19 -0500
committerRob Crittenden <rcritten@redhat.com>2013-02-06 16:20:37 -0500
commit076775a0f8c9ee0d17b1ed9356f1a8429fc47443 (patch)
tree7d8b5c4208d84a50a5dfc323b14b0394c1a7ab08 /install/tools/ipa-replica-manage
parentb27267b00a3261e0d4a4dd9e1f4055d43a6e663a (diff)
downloadfreeipa-076775a0f8c9ee0d17b1ed9356f1a8429fc47443.tar.gz
freeipa-076775a0f8c9ee0d17b1ed9356f1a8429fc47443.tar.xz
freeipa-076775a0f8c9ee0d17b1ed9356f1a8429fc47443.zip
Take into consideration services when deleting replicas
When deleting a replica from IPA domain: * Abort if the installation is about to be left without CA * Warn if the installation is about to be left without DNS Ticket: https://fedorahosted.org/freeipa/ticket/2879
Diffstat (limited to 'install/tools/ipa-replica-manage')
-rwxr-xr-xinstall/tools/ipa-replica-manage23
1 files changed, 23 insertions, 0 deletions
diff --git a/install/tools/ipa-replica-manage b/install/tools/ipa-replica-manage
index 0dad14319..809103565 100755
--- a/install/tools/ipa-replica-manage
+++ b/install/tools/ipa-replica-manage
@@ -628,6 +628,29 @@ def del_master(realm, hostname, options):
print "Deleting this server will orphan '%s'. " % orphaned_server
print "You will need to reconfigure your replication topology to delete this server."
sys.exit(1)
+
+ # Check that we are not leaving the installation without CA and/or DNS
+ this_services = []
+ other_services = []
+
+ for master_cn in [m.getValue('cn') for m in masters]:
+ master_dn = DN(('cn', master_cn), ('cn', 'masters'), ('cn', 'ipa'), ('cn', 'etc'), ipautil.realm_to_suffix(realm))
+ services = delrepl.conn.getList(master_dn, ldap.SCOPE_ONELEVEL)
+ services_cns = [s.getValue('cn') for s in services]
+
+ if master_cn == hostname:
+ this_services = services_cns
+ else:
+ other_services.append(services_cns)
+
+ if 'CA' in this_services and not any(['CA' in o for o in other_services]):
+ print "Deleting this server is not allowed as it would leave your installation without a CA."
+ sys.exit(1)
+
+ if 'DNS' in this_services and not any(['DNS' in o for o in other_services]):
+ print "Deleting this server will leave your installation without a DNS."
+ if not options.force and not ipautil.user_input("Continue to delete?", False):
+ sys.exit("Deletion aborted")
else:
print "Skipping calculation to determine if one or more masters would be orphaned."