On 10/11/2012 12:32 PM, Martin Kosek wrote:
On 10/11/2012 12:26 PM, Tomas Babej wrote:
Hi,

This patch forces more consistency into ipa-server-install output. All
descriptions of services that are not instances of
SimpleServiceInstance are now in the following format:

<Description> (<Service Name>)

Furthermore, start_creation method has been modified to support
custom start and end messages.

Sample output produced by this patch attached.

https://fedorahosted.org/freeipa/ticket/3059

Tomas

Just based on reading the patch, this does not look right:

-        self.start_creation("Configuring certificate server", 210)
+        self.start_creation("Configuring directory server for the CA",
+            end_message="Done configuring directory server for the CA",
+            show_service_name=True, runtime=210)

Martin

Thanks, glitch fixed.

Tomas
>From c6583949049ec0aa96ada54efe4b30055477bb59 Mon Sep 17 00:00:00 2001
From: Tomas Babej <tba...@redhat.com>
Date: Thu, 11 Oct 2012 03:32:17 -0400
Subject: [PATCH] Make service naming in ipa-server-install consistent

Forces more consistency into ipa-server-install output. All
descriptions of services that are not instances of
SimpleServiceInstance are now in the following format:

<Description> (<Service Name>)

Furthermore, start_creation method has been modified to support
custom start and end messages.

https://fedorahosted.org/freeipa/ticket/3059
---
 ipaserver/install/adtrustinstance.py |  3 ++-
 ipaserver/install/bindinstance.py    |  4 +++-
 ipaserver/install/cainstance.py      |  8 ++++++--
 ipaserver/install/dsinstance.py      |  8 ++++++--
 ipaserver/install/httpinstance.py    |  4 +++-
 ipaserver/install/krbinstance.py     |  8 ++++++--
 ipaserver/install/ntpinstance.py     |  4 +++-
 ipaserver/install/service.py         | 22 ++++++++++++++++------
 8 files changed, 45 insertions(+), 16 deletions(-)

diff --git a/ipaserver/install/adtrustinstance.py b/ipaserver/install/adtrustinstance.py
index b74f4b685b1cb56bdcdbae15ab6a8f38960bfc66..971f47f347a2f054cb76fc5b9e0e7d9f99cef239 100644
--- a/ipaserver/install/adtrustinstance.py
+++ b/ipaserver/install/adtrustinstance.py
@@ -757,7 +757,8 @@ class ADTRUSTInstance(service.Service):
             self.step("adding SIDs to existing users and groups",
                       self.__add_sids)
 
-        self.start_creation("Configuring CIFS:")
+        self.start_creation("Configuring CIFS",
+            end_message="Done configuring CIFS")
 
     def uninstall(self):
         if self.is_configured():
diff --git a/ipaserver/install/bindinstance.py b/ipaserver/install/bindinstance.py
index f43a9ff0f9114388ae072daa82c39aaff716f7b2..67400082278258a2853d54c4df68d00318c20da8 100644
--- a/ipaserver/install/bindinstance.py
+++ b/ipaserver/install/bindinstance.py
@@ -505,7 +505,9 @@ class BindInstance(service.Service):
         self.step("configuring named to start on boot", self.__enable)
 
         self.step("changing resolv.conf to point to ourselves", self.__setup_resolv_conf)
-        self.start_creation("Configuring named:")
+        self.start_creation("Configuring DNS",
+            end_message = "Done configuring DNS",
+            show_service_name=True)
 
     def __start(self):
         try:
diff --git a/ipaserver/install/cainstance.py b/ipaserver/install/cainstance.py
index aabbba39de95937153ebebef79bf8b9082d2e46e..0a8f603497693392ee4a73caea10cf13e4a36f09 100644
--- a/ipaserver/install/cainstance.py
+++ b/ipaserver/install/cainstance.py
@@ -277,7 +277,9 @@ class CADSInstance(service.Service):
         self.step("creating directory server instance", self.__create_instance)
         self.step("restarting directory server", self.restart_instance)
 
-        self.start_creation("Configuring directory server for the CA", 30)
+        self.start_creation("Configuring directory server for the CA",
+            end_message="Done configuring directory server for the CA",
+            show_service_name=True, runtime=210)
 
     def __setup_sub_dict(self):
         server_root = dsinstance.find_server_root()
@@ -576,7 +578,9 @@ class CAInstance(service.Service):
             self.step("configure Server-Cert certificate renewal", self.track_servercert)
             self.step("Configure HTTP to proxy connections", self.__http_proxy)
 
-        self.start_creation("Configuring certificate server", 210)
+        self.start_creation("Configuring certificate server",
+            end_message="Done configuring certificate server",
+            show_service_name=True, runtime=30)
 
     def __spawn_instance(self):
         """
diff --git a/ipaserver/install/dsinstance.py b/ipaserver/install/dsinstance.py
index 2c9832d0277560ea85bdc29c7167a46430c78771..849661a1ec4bdb940d745b82a9631f64bf546e93 100644
--- a/ipaserver/install/dsinstance.py
+++ b/ipaserver/install/dsinstance.py
@@ -255,7 +255,9 @@ class DsInstance(service.Service):
 
         self.__common_post_setup()
 
-        self.start_creation("Configuring directory server", 60)
+        self.start_creation("Configuring directory server",
+            end_message="Done configuring directory server",
+            show_service_name=True, runtime=60)
 
     def create_replica(self, realm_name, master_fqdn, fqdn,
                        domain_name, dm_password, pkcs12_info=None):
@@ -289,7 +291,9 @@ class DsInstance(service.Service):
 
         self.__common_post_setup()
 
-        self.start_creation("Configuring directory server", 60)
+        self.start_creation("Configuring directory server",
+            end_message="Done configuring directory server",
+            show_service_name=True, runtime=60)
 
 
     def __setup_replica(self):
diff --git a/ipaserver/install/httpinstance.py b/ipaserver/install/httpinstance.py
index 29077367dc17b6df0618c4740fad445edc43e790..a234fb9916762a44dc5736bbfb5d1e10aefe3e0c 100644
--- a/ipaserver/install/httpinstance.py
+++ b/ipaserver/install/httpinstance.py
@@ -99,7 +99,9 @@ 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", 60)
+        self.start_creation("Configuring the web interface",
+            end_message="Done configuring the web interface",
+            show_service_name=True, runtime=60)
 
     def __start(self):
         self.backup_state("running", self.is_running())
diff --git a/ipaserver/install/krbinstance.py b/ipaserver/install/krbinstance.py
index 9101e6fcce353eea4ed9457808896dc06da1d966..5f0a2190ba8fa7f03f9aeaaaac3d4bc9a768f52d 100644
--- a/ipaserver/install/krbinstance.py
+++ b/ipaserver/install/krbinstance.py
@@ -180,7 +180,9 @@ class KrbInstance(service.Service):
 
         self.__common_post_setup()
 
-        self.start_creation("Configuring Kerberos KDC", 30)
+        self.start_creation("Configuring Kerberos KDC",
+            end_message="Done configuring Kerberos KDC",
+            show_service_name=True, runtime=30)
 
         self.kpasswd = KpasswdInstance()
         self.kpasswd.create_instance('KPASSWD', self.fqdn, self.admin_password, self.suffix, realm=self.realm)
@@ -209,7 +211,9 @@ class KrbInstance(service.Service):
 
         self.__common_post_setup()
 
-        self.start_creation("Configuring Kerberos KDC", 30)
+        self.start_creation("Configuring Kerberos KDC",
+            end_message="Done configuring Kerberos KDC",
+            show_service_name=True, runtime=30)
 
         self.kpasswd = KpasswdInstance()
         self.kpasswd.create_instance('KPASSWD', self.fqdn, self.admin_password, self.suffix)
diff --git a/ipaserver/install/ntpinstance.py b/ipaserver/install/ntpinstance.py
index e1b72dda595bf28c3789231423d8293d34d5a9a2..54de326407df23a4e94f29ae28b317374633443e 100644
--- a/ipaserver/install/ntpinstance.py
+++ b/ipaserver/install/ntpinstance.py
@@ -155,7 +155,9 @@ class NTPInstance(service.Service):
         self.step("configuring ntpd to start on boot", self.__enable)
         self.step("starting ntpd", self.__start)
 
-        self.start_creation("Configuring ntpd")
+        self.start_creation("Configuring NTP daemon",
+            end_message="Done configuring NTP daemon",
+            show_service_name=True)
 
     def uninstall(self):
         if self.is_configured():
diff --git a/ipaserver/install/service.py b/ipaserver/install/service.py
index 1d157eba474615307663993d39fcbff41c3197ad..4ff44c9c64a213e4e62feeb201090287ac52adb6 100644
--- a/ipaserver/install/service.py
+++ b/ipaserver/install/service.py
@@ -296,7 +296,12 @@ class Service(object):
     def step(self, message, method):
         self.steps.append((message, method))
 
-    def start_creation(self, message, runtime=-1):
+    def start_creation(self, start_message, end_message=None, show_service_name=False, runtime=-1):
+        if show_service_name is True:
+            start_message = '%s (%s)' % (start_message, self.service_name)
+            if end_message is not None:
+                end_message = '%s (%s)' % (end_message, self.service_name)
+
         if runtime > 0:
             plural=''
             est = time.localtime(runtime)
@@ -304,15 +309,15 @@ class Service(object):
                 if est.tm_min > 1:
                     plural = 's'
                 if est.tm_sec > 0:
-                    self.print_msg('%s: Estimated time %d minute%s %d seconds' % (message, est.tm_min, plural, est.tm_sec))
+                    self.print_msg('%s: Estimated time %d minute%s %d seconds' % (start_message, est.tm_min, plural, est.tm_sec))
                 else:
-                    self.print_msg('%s: Estimated time %d minute%s' % (message, est.tm_min, plural))
+                    self.print_msg('%s: Estimated time %d minute%s' % (start_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))
+                self.print_msg('%s: Estimated time %d second%s' % (start_message, est.tm_sec, plural))
         else:
-            self.print_msg(message)
+            self.print_msg(start_message)
 
         step = 0
         for (message, method) in self.steps:
@@ -324,7 +329,12 @@ class Service(object):
             root_logger.debug("  duration: %d seconds" % d.seconds)
             step += 1
 
-        self.print_msg("done configuring %s." % self.service_name)
+        if end_message is not None:
+            self.print_msg('%s.' % end_message)
+        elif show_service_name is True:
+            self.print_msg('Done configuring %s.' % self.service_name)
+        else:
+            self.print_msg('Done.')
 
         self.steps = []
 
-- 
1.7.11.7

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to