diff options
author | Rob Crittenden <rcritten@redhat.com> | 2010-09-29 13:55:54 -0400 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2010-10-08 10:11:45 -0400 |
commit | 90e716460e2e1acf95a74370d5e4dfd9f9138bcf (patch) | |
tree | 92fc512823d23e617b80bdccdc73a191b9fa1685 /ipaserver/install/service.py | |
parent | bed6e81935a43e0661faf2391c2494b230222c17 (diff) | |
download | freeipa-90e716460e2e1acf95a74370d5e4dfd9f9138bcf.tar.gz freeipa-90e716460e2e1acf95a74370d5e4dfd9f9138bcf.tar.xz freeipa-90e716460e2e1acf95a74370d5e4dfd9f9138bcf.zip |
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
Diffstat (limited to 'ipaserver/install/service.py')
-rw-r--r-- | ipaserver/install/service.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/ipaserver/install/service.py b/ipaserver/install/service.py index 47489c09c..4affef457 100644 --- a/ipaserver/install/service.py +++ b/ipaserver/install/service.py @@ -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) |