summaryrefslogtreecommitdiffstats
path: root/ipa-server/ipaserver/service.py
diff options
context:
space:
mode:
Diffstat (limited to 'ipa-server/ipaserver/service.py')
-rw-r--r--ipa-server/ipaserver/service.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/ipa-server/ipaserver/service.py b/ipa-server/ipaserver/service.py
index 4b2799702..90d0e606a 100644
--- a/ipa-server/ipaserver/service.py
+++ b/ipa-server/ipaserver/service.py
@@ -45,8 +45,7 @@ def print_msg(message, output_fd=sys.stdout):
class Service:
def __init__(self, service_name):
self.service_name = service_name
- self.num_steps = -1
- self.current_step = -1
+ self.steps = []
self.output_fd = sys.stdout
def set_output(self, fd):
@@ -69,18 +68,19 @@ class Service:
def print_msg(self, message):
print_msg(message, self.output_fd)
-
- def start_creation(self, num_steps, message):
- self.num_steps = num_steps
- self.cur_step = 0
- self.print_msg(message)
- def step(self, message):
- self.cur_step += 1
- self.print_msg(" [%d/%d]: %s" % (self.cur_step, self.num_steps, message))
+ def step(self, message, method):
+ self.steps.append((message, method))
- def done_creation(self):
- self.cur_step = -1
- self.num_steps = -1
+ def start_creation(self, message):
+ self.print_msg(message)
+
+ step = 0
+ for (message, method) in self.steps:
+ self.print_msg(" [%d/%d]: %s" % (step, len(self.steps), message))
+ method()
+ step += 1
+
self.print_msg("done configuring %s." % self.service_name)
+ self.steps = []