diff options
author | Tomas Babej <tbabej@redhat.com> | 2013-04-10 13:00:45 +0200 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2013-05-02 10:55:54 -0400 |
commit | 66b1d435c3e29bb536121d35dd495f6cc4088571 (patch) | |
tree | 3bc5753f77e63fb24df1f2adf89065747564d683 /install/tools/ipa-replica-manage | |
parent | 6839483d2911d70bfcc49f8f05f0f9f1860cedb4 (diff) | |
download | freeipa-66b1d435c3e29bb536121d35dd495f6cc4088571.tar.gz freeipa-66b1d435c3e29bb536121d35dd495f6cc4088571.tar.xz freeipa-66b1d435c3e29bb536121d35dd495f6cc4088571.zip |
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
Diffstat (limited to 'install/tools/ipa-replica-manage')
-rwxr-xr-x | install/tools/ipa-replica-manage | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/install/tools/ipa-replica-manage b/install/tools/ipa-replica-manage index af453f6fd..2fb32fa2a 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 @@ -751,9 +752,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" % @@ -1247,6 +1256,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) |