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:
Rob Crittenden 2010-09-29 13:55:54 -04:00
parent bed6e81935
commit 90e716460e
5 changed files with 26 additions and 8 deletions

View File

@ -245,7 +245,7 @@ class CADSInstance(service.Service):
self.step("configuring directory to start on boot", self.__enable) self.step("configuring directory to start on boot", self.__enable)
self.step("restarting directory server", self.__restart_instance) 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): def __setup_sub_dict(self):
server_root = dsinstance.find_server_root() 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("configuring certificate server to start on boot", self.__enable)
self.step("restarting certificate server", self.__restart_instance) 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): def create_instance(self):
""" """

View File

@ -224,7 +224,7 @@ class DsInstance(service.Service):
self.step("configuring directory to start on boot", self.__enable) 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): def __enable(self):
self.backup_state("enabled", self.is_enabled()) self.backup_state("enabled", self.is_enabled())

View File

@ -83,7 +83,7 @@ class HTTPInstance(service.Service):
self.step("restarting httpd", self.__start) self.step("restarting httpd", self.__start)
self.step("configuring httpd to start on boot", self.__enable) 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): def __start(self):
self.backup_state("running", self.is_running()) self.backup_state("running", self.is_running())

View File

@ -178,7 +178,7 @@ class KrbInstance(service.Service):
self.__common_post_setup() self.__common_post_setup()
self.start_creation("Configuring Kerberos KDC") self.start_creation("Configuring Kerberos KDC", 30)
self.kpasswd = KpasswdInstance() self.kpasswd = KpasswdInstance()
@ -199,7 +199,7 @@ class KrbInstance(service.Service):
self.__common_post_setup() self.__common_post_setup()
self.start_creation("Configuring Kerberos KDC") self.start_creation("Configuring Kerberos KDC", 30)
self.kpasswd = KpasswdInstance() self.kpasswd = KpasswdInstance()
self.kpasswd.create_instance() self.kpasswd.create_instance()

View File

@ -26,6 +26,8 @@ from ipalib import uuid, errors
import ldap import ldap
from ipaserver import ipaldap from ipaserver import ipaldap
import base64 import base64
import time
import datetime
def stop(service_name, instance_name=""): def stop(service_name, instance_name=""):
@ -233,13 +235,29 @@ class Service:
def step(self, message, method): def step(self, message, method):
self.steps.append((message, method)) self.steps.append((message, method))
def start_creation(self, 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) self.print_msg(message)
step = 0 step = 0
for (message, method) in self.steps: for (message, method) in self.steps:
self.print_msg(" [%d/%d]: %s" % (step+1, len(self.steps), message)) self.print_msg(" [%d/%d]: %s" % (step+1, len(self.steps), message))
s = datetime.datetime.now()
method() method()
e = datetime.datetime.now()
d = e - s
logging.debug(" duration: %d seconds" % d.seconds)
step += 1 step += 1
self.print_msg("done configuring %s." % self.service_name) self.print_msg("done configuring %s." % self.service_name)