On 04/09/2013 01:54 PM, Tomas Babej wrote:
Hi,
In ipa-replica-manage commands, we enforce that hostnames we work
with are resolvable. However, this caused errors while deleting
or disconnecting a ipa / winsync replica, if that replica was down
and authoritative server for itself.
https://fedorahosted.org/freeipa/ticket/3524
Tomas
Attaching a fix for ipa-replica-manage which gracelly handles connection
timeout.
Please apply on top of 0045.
Tomas
>From e618c31751ad9c97a1a90d19ef10e43ae6c6da17 Mon Sep 17 00:00:00 2001
From: Tomas Babej <tba...@redhat.com>
Date: Wed, 10 Apr 2013 13:00:45 +0200
Subject: [PATCH] Handle connection timeout in ipa-replica-manage
When connecting to replica, ipa-replica-manage could fail with
unknown error due to connection time out. This patch properly
handles the situation
---
install/tools/ipa-replica-manage | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/install/tools/ipa-replica-manage b/install/tools/ipa-replica-manage
index ae66a7b716fb3e23c71ba0ed7b75900d9fdebddd..754e921c05a04fc7fa040646ad141bd5b9de9a49 100755
--- a/install/tools/ipa-replica-manage
+++ b/install/tools/ipa-replica-manage
@@ -24,6 +24,7 @@ import re, krbV
import traceback
from urllib2 import urlparse
import ldap
+import socket
from ipapython import ipautil
from ipaserver.install import replication, dsinstance, installutils
@@ -728,9 +729,17 @@ def add_link(realm, replica1, replica2, dirman_passwd, options):
root_logger.error("winsync agreements need to be created as root")
sys.exit(1)
- # See if we already have an agreement with this host
try:
repl = replication.ReplicationManager(realm, replica1, dirman_passwd)
+ except errors.NotFound:
+ print "Cannot find replica '%s'" % replica1
+ return
+ except Exception, e:
+ print "Failed to connect to '%s': %s" % (replica1, e)
+ return
+
+ # See if we already have an agreement with this host
+ try:
if repl.get_agreement_type(replica2) == replication.WINSYNC:
agreement = repl.get_replication_agreement(replica2)
sys.exit("winsync agreement already exists on subtree %s" %
@@ -1204,6 +1213,9 @@ except SystemExit, e:
sys.exit(e)
except RuntimeError, e:
sys.exit(e)
+except socket.timeout:
+ print "Connection timed out."
+ sys.exit(1)
except Exception, e:
print "unexpected error: %s" % str(e)
sys.exit(1)
--
1.8.1.4
_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel