mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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 Fixed in conjunction with https://fedorahosted.org/freeipa/ticket/3524
This commit is contained in:
committed by
Rob Crittenden
parent
6839483d29
commit
66b1d435c3
@@ -24,6 +24,7 @@ import re, krbV
|
|||||||
import traceback
|
import traceback
|
||||||
from urllib2 import urlparse
|
from urllib2 import urlparse
|
||||||
import ldap
|
import ldap
|
||||||
|
import socket
|
||||||
|
|
||||||
from ipapython import ipautil
|
from ipapython import ipautil
|
||||||
from ipaserver.install import replication, dsinstance, installutils
|
from ipaserver.install import replication, dsinstance, installutils
|
||||||
@@ -751,9 +752,17 @@ def add_link(realm, replica1, replica2, dirman_passwd, options):
|
|||||||
root_logger.error("winsync agreements need to be created as root")
|
root_logger.error("winsync agreements need to be created as root")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# See if we already have an agreement with this host
|
|
||||||
try:
|
try:
|
||||||
repl = replication.ReplicationManager(realm, replica1, dirman_passwd)
|
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:
|
if repl.get_agreement_type(replica2) == replication.WINSYNC:
|
||||||
agreement = repl.get_replication_agreement(replica2)
|
agreement = repl.get_replication_agreement(replica2)
|
||||||
sys.exit("winsync agreement already exists on subtree %s" %
|
sys.exit("winsync agreement already exists on subtree %s" %
|
||||||
@@ -1247,6 +1256,9 @@ except SystemExit, e:
|
|||||||
sys.exit(e)
|
sys.exit(e)
|
||||||
except RuntimeError, e:
|
except RuntimeError, e:
|
||||||
sys.exit(e)
|
sys.exit(e)
|
||||||
|
except socket.timeout:
|
||||||
|
print "Connection timed out."
|
||||||
|
sys.exit(1)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print "unexpected error: %s" % str(e)
|
print "unexpected error: %s" % str(e)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user