summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorAlexander Bokovoy <abokovoy@redhat.com>2011-10-10 15:25:15 +0300
committerMartin Kosek <mkosek@redhat.com>2011-10-24 15:10:11 +0200
commit25d5d7ed939384340c0aa7d00989cbddf4226bcd (patch)
tree3f738da9e1603b5577e1fb2a644b8a3c9a189162 /install
parentf098b213eb3d2e8e5d47689a226f81a0d1b35262 (diff)
downloadfreeipa.git-25d5d7ed939384340c0aa7d00989cbddf4226bcd.tar.gz
freeipa.git-25d5d7ed939384340c0aa7d00989cbddf4226bcd.tar.xz
freeipa.git-25d5d7ed939384340c0aa7d00989cbddf4226bcd.zip
Add support for systemd environments and use it to support Fedora 16
https://fedorahosted.org/freeipa/ticket/1192
Diffstat (limited to 'install')
-rwxr-xr-xinstall/tools/ipactl12
1 files changed, 11 insertions, 1 deletions
diff --git a/install/tools/ipactl b/install/tools/ipactl
index 4055cf91..808849ff 100755
--- a/install/tools/ipactl
+++ b/install/tools/ipactl
@@ -24,7 +24,7 @@ try:
from ipaserver.install import service
from ipapython import services as ipaservices
from ipaserver.install.dsinstance import config_dirname, realm_to_serverid
- from ipaserver.install.installutils import is_ipa_configured
+ from ipaserver.install.installutils import is_ipa_configured, wait_for_open_ports, wait_for_open_socket
from ipapython import sysrestore
from ipapython import config
from ipalib import api, errors
@@ -32,6 +32,7 @@ try:
import logging
import ldap
import ldap.sasl
+ import ldapurl
import socket
except ImportError:
print >> sys.stderr, """\
@@ -117,6 +118,15 @@ def get_config():
attrs = ['cn', 'ipaConfigString']
try:
+ # systemd services are so fast that we come here before
+ # Directory Server actually starts listening. Wait for
+ # the socket/port be really available.
+ lurl = ldapurl.LDAPUrl(api.env.ldap_uri)
+ if lurl.urlscheme == 'ldapi':
+ wait_for_open_socket(lurl.hostport, timeout=6)
+ else:
+ (host,port) = lurl.hostport.split(':')
+ wait_for_open_ports(host, [int(port)], timeout=6)
con = ldap.initialize(api.env.ldap_uri)
con.sasl_interactive_bind_s('', SASL_EXTERNAL)
res = con.search_st(base,