summaryrefslogtreecommitdiffstats
path: root/ipaserver/install
diff options
context:
space:
mode:
Diffstat (limited to 'ipaserver/install')
-rw-r--r--ipaserver/install/cainstance.py1
-rw-r--r--ipaserver/install/dsinstance.py3
-rw-r--r--ipaserver/install/installutils.py52
-rw-r--r--ipaserver/install/plugins/baseupdate.py8
-rw-r--r--ipaserver/install/plugins/updateclient.py4
-rw-r--r--ipaserver/install/replication.py2
-rw-r--r--ipaserver/install/service.py10
-rw-r--r--ipaserver/install/upgradeinstance.py5
8 files changed, 22 insertions, 63 deletions
diff --git a/ipaserver/install/cainstance.py b/ipaserver/install/cainstance.py
index af8d39aa..62c1dc4d 100644
--- a/ipaserver/install/cainstance.py
+++ b/ipaserver/install/cainstance.py
@@ -681,7 +681,6 @@ class CAInstance(service.Service):
def __restart_instance(self):
try:
self.restart(PKI_INSTANCE_NAME)
- installutils.wait_for_open_ports('localhost', 9180, 300)
except Exception:
# TODO: roll back here?
root_logger.critical("Failed to restart the certificate server. See the installation log for details.")
diff --git a/ipaserver/install/dsinstance.py b/ipaserver/install/dsinstance.py
index d74ee898..9c137af0 100644
--- a/ipaserver/install/dsinstance.py
+++ b/ipaserver/install/dsinstance.py
@@ -416,7 +416,6 @@ class DsInstance(service.Service):
if not is_ds_running(instance):
root_logger.critical("Failed to restart the directory server. See the installation log for details.")
sys.exit(1)
- installutils.wait_for_open_ports('localhost', self.open_ports, 300)
except SystemExit, e:
raise e
except Exception, e:
@@ -667,7 +666,7 @@ class DsInstance(service.Service):
# (re)start them.
for ds_instance in get_ds_instances():
try:
- ipaservices.knownservices.dirsrv.restart(ds_instance)
+ ipaservices.knownservices.dirsrv.restart(ds_instance, wait=False)
except Exception, e:
root_logger.error('Unable to restart ds instance %s: %s', ds_instance, e)
diff --git a/ipaserver/install/installutils.py b/ipaserver/install/installutils.py
index 31376177..b65958ed 100644
--- a/ipaserver/install/installutils.py
+++ b/ipaserver/install/installutils.py
@@ -414,58 +414,6 @@ def create_keytab(path, principal):
kadmin("ktadd -k " + path + " " + principal)
-def wait_for_open_ports(host, ports, timeout=0):
- """
- Wait until the specified port(s) on the remote host are open. Timeout
- in seconds may be specified to limit the wait.
- """
- if not isinstance(ports, (tuple, list)):
- ports = [ports]
-
- op_timeout = time.time() + timeout
- ipv6_failover = False
-
- for port in ports:
- while True:
- try:
- if ipv6_failover:
- s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
- else:
- s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- s.connect((host, port))
- s.close()
- break;
- except socket.error, e:
- if e.errno == 111: # 111: Connection refused
- if timeout and time.time() > op_timeout: # timeout exceeded
- raise e
- time.sleep(1)
- elif not ipv6_failover: # fallback to IPv6 connection
- ipv6_failover = True
- else:
- raise e
-
-def wait_for_open_socket(socket_name, timeout=0):
- """
- Wait until the specified socket on the local host is open. Timeout
- in seconds may be specified to limit the wait.
- """
- op_timeout = time.time() + timeout
-
- while True:
- try:
- s = socket.socket(socket.AF_UNIX)
- s.connect(socket_name)
- s.close()
- break;
- except socket.error, e:
- if e.errno in (2,111): # 111: Connection refused, 2: File not found
- if timeout and time.time() > op_timeout: # timeout exceeded
- raise e
- time.sleep(1)
- else:
- raise e
-
def resolve_host(host_name):
try:
addrinfos = socket.getaddrinfo(host_name, None,
diff --git a/ipaserver/install/plugins/baseupdate.py b/ipaserver/install/plugins/baseupdate.py
index 227dc917..f91cf5de 100644
--- a/ipaserver/install/plugins/baseupdate.py
+++ b/ipaserver/install/plugins/baseupdate.py
@@ -34,6 +34,14 @@ class DSRestart(service.Service):
"""
service.Service.__init__(self, "dirsrv")
+ def start(self, instance_name="", capture_output=True, wait=True):
+ """
+ During upgrades the server is listening only on the socket so
+ we don't want to wait on ports. The caller is responsible for
+ waiting for the socket to be ready.
+ """
+ super(DSRestart, self).start(wait=False)
+
def create_instance(self):
self.step("stopping directory server", self.stop)
self.step("starting directory server", self.start)
diff --git a/ipaserver/install/plugins/updateclient.py b/ipaserver/install/plugins/updateclient.py
index 10d899ab..e2376947 100644
--- a/ipaserver/install/plugins/updateclient.py
+++ b/ipaserver/install/plugins/updateclient.py
@@ -18,11 +18,11 @@
#
import os
-from ipaserver.install import installutils
from ipaserver.install.plugins import FIRST, MIDDLE, LAST
from ipaserver.install.plugins import POST_UPDATE
from ipaserver.install.plugins.baseupdate import DSRestart
from ipaserver.install.ldapupdate import LDAPUpdate
+from ipapython.ipautil import wait_for_open_socket
from ipalib import api
from ipalib import backend
import ldap as _ldap
@@ -161,7 +161,7 @@ class updateclient(backend.Executioner):
if live_run:
self.destroy_context()
dsrestart.create_instance()
- installutils.wait_for_open_socket(socket_name)
+ wait_for_open_socket(socket_name)
self.create_context(dm_password)
else:
self.log.warn("Test mode, skipping restart")
diff --git a/ipaserver/install/replication.py b/ipaserver/install/replication.py
index 03758dfc..417b7a0c 100644
--- a/ipaserver/install/replication.py
+++ b/ipaserver/install/replication.py
@@ -25,7 +25,6 @@ import sys
import ldap
from ipaserver import ipaldap
from ipapython import services as ipaservices
-import installutils
from ldap import modlist
from ipalib import api, util, errors
from ipapython import ipautil
@@ -92,7 +91,6 @@ def enable_replication_version_checking(hostname, realm, dirman_passwd):
conn.unbind()
serverid = "-".join(realm.split("."))
ipaservices.knownservices.dirsrv.restart(instance_name=serverid)
- installutils.wait_for_open_ports('localhost', [389, 636], 300)
else:
conn.unbind()
diff --git a/ipaserver/install/service.py b/ipaserver/install/service.py
index 5cc7ae63..5c2699e3 100644
--- a/ipaserver/install/service.py
+++ b/ipaserver/install/service.py
@@ -35,6 +35,8 @@ from ipapython.ipa_log_manager import *
CACERT = "/etc/ipa/ca.crt"
+# The service name as stored in cn=masters,cn=ipa,cn=etc. In the tuple
+# the first value is the *nix service name, the second the start order.
SERVICE_LIST = {
'KDC':('krb5kdc', 10),
'KPASSWD':('kadmin', 20),
@@ -198,11 +200,11 @@ class Service(object):
def stop(self, instance_name="", capture_output=True):
self.service.stop(instance_name, capture_output=capture_output)
- def start(self, instance_name="", capture_output=True):
- self.service.start(instance_name, capture_output=capture_output)
+ def start(self, instance_name="", capture_output=True, wait=True):
+ self.service.start(instance_name, capture_output=capture_output, wait=wait)
- def restart(self, instance_name="", capture_output=True):
- self.service.restart(instance_name, capture_output=capture_output)
+ def restart(self, instance_name="", capture_output=True, wait=True):
+ self.service.restart(instance_name, capture_output=capture_output, wait=wait)
def is_running(self):
return self.service.is_running()
diff --git a/ipaserver/install/upgradeinstance.py b/ipaserver/install/upgradeinstance.py
index b04d92af..f1f702b1 100644
--- a/ipaserver/install/upgradeinstance.py
+++ b/ipaserver/install/upgradeinstance.py
@@ -60,6 +60,11 @@ class IPAUpgrade(service.Service):
self.badsyntax = False
self.upgradefailed = False
+ def start(self, instance_name="", capture_output=True, wait=True):
+ # Don't wait here because we've turned off port 389. The connection
+ # we make will wait for the socket.
+ super(IPAUpgrade, self).start(instance_name, capture_output, wait=False)
+
def create_instance(self):
self.step("stopping directory server", self.stop)
self.step("saving configuration", self.__save_config)