mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-26 17:01:14 -06:00
Include time duration hints when configuring services in ipa-server-install.
Give a better heads-up on how long the installation will take. Particularly important when configuring dogtag. ticket 139
This commit is contained in:
parent
bed6e81935
commit
90e716460e
@ -245,7 +245,7 @@ class CADSInstance(service.Service):
|
||||
self.step("configuring directory to start on boot", self.__enable)
|
||||
self.step("restarting directory server", self.__restart_instance)
|
||||
|
||||
self.start_creation("Configuring directory server for the CA:")
|
||||
self.start_creation("Configuring directory server for the CA", 30)
|
||||
|
||||
def __setup_sub_dict(self):
|
||||
server_root = dsinstance.find_server_root()
|
||||
@ -455,7 +455,7 @@ class CAInstance(service.Service):
|
||||
self.step("configuring certificate server to start on boot", self.__enable)
|
||||
self.step("restarting certificate server", self.__restart_instance)
|
||||
|
||||
self.start_creation("Configuring certificate server:")
|
||||
self.start_creation("Configuring certificate server", 360)
|
||||
|
||||
def create_instance(self):
|
||||
"""
|
||||
|
@ -224,7 +224,7 @@ class DsInstance(service.Service):
|
||||
|
||||
self.step("configuring directory to start on boot", self.__enable)
|
||||
|
||||
self.start_creation("Configuring directory server:")
|
||||
self.start_creation("Configuring directory server", 60)
|
||||
|
||||
def __enable(self):
|
||||
self.backup_state("enabled", self.is_enabled())
|
||||
|
@ -83,7 +83,7 @@ class HTTPInstance(service.Service):
|
||||
self.step("restarting httpd", self.__start)
|
||||
self.step("configuring httpd to start on boot", self.__enable)
|
||||
|
||||
self.start_creation("Configuring the web interface")
|
||||
self.start_creation("Configuring the web interface", 60)
|
||||
|
||||
def __start(self):
|
||||
self.backup_state("running", self.is_running())
|
||||
|
@ -178,7 +178,7 @@ class KrbInstance(service.Service):
|
||||
|
||||
self.__common_post_setup()
|
||||
|
||||
self.start_creation("Configuring Kerberos KDC")
|
||||
self.start_creation("Configuring Kerberos KDC", 30)
|
||||
|
||||
self.kpasswd = KpasswdInstance()
|
||||
|
||||
@ -199,7 +199,7 @@ class KrbInstance(service.Service):
|
||||
|
||||
self.__common_post_setup()
|
||||
|
||||
self.start_creation("Configuring Kerberos KDC")
|
||||
self.start_creation("Configuring Kerberos KDC", 30)
|
||||
|
||||
self.kpasswd = KpasswdInstance()
|
||||
self.kpasswd.create_instance()
|
||||
|
@ -26,6 +26,8 @@ from ipalib import uuid, errors
|
||||
import ldap
|
||||
from ipaserver import ipaldap
|
||||
import base64
|
||||
import time
|
||||
import datetime
|
||||
|
||||
|
||||
def stop(service_name, instance_name=""):
|
||||
@ -233,13 +235,29 @@ class Service:
|
||||
def step(self, message, method):
|
||||
self.steps.append((message, method))
|
||||
|
||||
def start_creation(self, message):
|
||||
self.print_msg(message)
|
||||
def start_creation(self, message, runtime=-1):
|
||||
if runtime > 0:
|
||||
plural=''
|
||||
est = time.localtime(runtime)
|
||||
if est.tm_min > 0:
|
||||
if est.tm_min > 1:
|
||||
plural = 's'
|
||||
self.print_msg('%s: Estimated time %d minute%s' % (message, est.tm_min, plural))
|
||||
else:
|
||||
if est.tm_sec > 1:
|
||||
plural = 's'
|
||||
self.print_msg('%s: Estimated time %d second%s' % (message, est.tm_sec, plural))
|
||||
else:
|
||||
self.print_msg(message)
|
||||
|
||||
step = 0
|
||||
for (message, method) in self.steps:
|
||||
self.print_msg(" [%d/%d]: %s" % (step+1, len(self.steps), message))
|
||||
s = datetime.datetime.now()
|
||||
method()
|
||||
e = datetime.datetime.now()
|
||||
d = e - s
|
||||
logging.debug(" duration: %d seconds" % d.seconds)
|
||||
step += 1
|
||||
|
||||
self.print_msg("done configuring %s." % self.service_name)
|
||||
|
Loading…
Reference in New Issue
Block a user