Since ipa-replica-* tools will be soon removed I think this simple check
should be enough.
--
David Kupka
From c97001b0724599c4fa4943c4f01d2458b51238ac Mon Sep 17 00:00:00 2001
From: David Kupka <[email protected]>
Date: Fri, 3 Jul 2015 05:59:55 +0200
Subject: [PATCH] ipa-replica-prepare: Do not create DNS zone it automatically.
When --ip-address is specified check if relevant DNS zone exists
in IPA managed DNS server, exit with error when not.
https://fedorahosted.org/freeipa/ticket/5014
---
ipaserver/install/ipa_replica_prepare.py | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/ipaserver/install/ipa_replica_prepare.py b/ipaserver/install/ipa_replica_prepare.py
index 46ac886e5a0f86574531861159d955bd149648c4..345c44c510e9cc4ac294f3770328db1e6b017087 100644
--- a/ipaserver/install/ipa_replica_prepare.py
+++ b/ipaserver/install/ipa_replica_prepare.py
@@ -264,6 +264,15 @@ class ReplicaPrepare(admintool.AdminTool):
options.reverse_zones = bindinstance.check_reverse_zones(
options.ip_addresses, options.reverse_zones, options, False,
True)
+
+ host, zone = self.replica_fqdn.split('.', 1)
+ if not bindinstance.dns_zone_exists(zone, api=api):
+ self.log.error("DNS zone %s does not exist in IPA "
+ "managed DNS server. Either create "
+ "DNS zone or omit --ip-address option."
+ % zone)
+ raise admintool.ScriptError("Cannot add DNS record")
+
if disconnect:
api.Backend.ldap2.disconnect()
@@ -481,11 +490,6 @@ class ReplicaPrepare(admintool.AdminTool):
api.Backend.ldap2.connect(
bind_dn=DN(('cn', 'Directory Manager')),
bind_pw=self.dirman_password)
- try:
- add_zone(domain)
- except errors.PublicError, e:
- raise admintool.ScriptError(
- "Could not create master DNS zone for the replica: %s" % e)
for reverse_zone in options.reverse_zones:
self.log.info("Adding reverse zone %s", reverse_zone)
--
2.4.3
--
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code