summaryrefslogtreecommitdiffstats
path: root/ipaserver/install/service.py
diff options
context:
space:
mode:
Diffstat (limited to 'ipaserver/install/service.py')
-rw-r--r--ipaserver/install/service.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/ipaserver/install/service.py b/ipaserver/install/service.py
index 47489c09..4affef45 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)