When DNS zone/record manipulation commands fails for example due to
a ValidationError, ipa-replica-prepapre reports a whole traceback
which is difficult to read. Make sure our error error is more
readable.

https://fedorahosted.org/freeipa/ticket/3283
From 3f0a11b2b57132b8ff537c273567c3c920f9f826 Mon Sep 17 00:00:00 2001
From: Martin Kosek <mko...@redhat.com>
Date: Tue, 4 Dec 2012 16:51:17 +0100
Subject: [PATCH] Improve ipa-replica-prepare error message

When DNS zone/record manipulation commands fails for example due to
a ValidationError, ipa-replica-prepapre reports a whole traceback
which is difficult to read. Make sure our error error is more
readable.

https://fedorahosted.org/freeipa/ticket/3283
---
 install/tools/ipa-replica-prepare | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/install/tools/ipa-replica-prepare b/install/tools/ipa-replica-prepare
index f9d0eb6469d9ca1508e82151be6106fa7348b35b..274e8456af65fad31af4331ba0648aef088ec33a 100755
--- a/install/tools/ipa-replica-prepare
+++ b/install/tools/ipa-replica-prepare
@@ -467,13 +467,26 @@ def main():
             if reverse_zone is None and not options.no_reverse:
                 reverse_zone = bindinstance.get_reverse_zone_default(ip)
 
-        add_zone(domain)
-        add_fwd_rr(domain, name, ip_address)
+        try:
+            add_zone(domain)
+        except errors.PublicError, e:
+            sys.exit("Could not create forward DNS zone for the replica: %s" % e)
+
+        try:
+            add_fwd_rr(domain, name, ip_address)
+        except errors.PublicError, e:
+            sys.exit("Could not add forward DNS record for the replica: %s" % e)
 
         if reverse_zone is not None:
             print "Using reverse zone %s" % reverse_zone
-            add_zone(reverse_zone)
-            add_ptr_rr(reverse_zone, ip_address, replica_fqdn)
+            try:
+                add_zone(reverse_zone)
+            except errors.PublicError, e:
+                sys.exit("Could not create reverse DNS zone for the replica: %s" % e)
+            try:
+                add_ptr_rr(reverse_zone, ip_address, replica_fqdn)
+            except errors.PublicError, e:
+                sys.exit("Could not add reverse DNS record for the replica: %s" % e)
 
 try:
     if not os.geteuid()==0:
-- 
1.7.11.7

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to