e3ffab
From 3229a4c7ae1167103e954d5101bac1d56b28ce0d Mon Sep 17 00:00:00 2001
e3ffab
From: Jan Cholasta <jcholast@redhat.com>
e3ffab
Date: Tue, 13 Jan 2015 10:59:08 +0000
e3ffab
Subject: [PATCH] Do not crash on unknown services in
e3ffab
 installutils.stopped_service
e3ffab
e3ffab
https://fedorahosted.org/freeipa/ticket/4835
e3ffab
e3ffab
Reviewed-By: David Kupka <dkupka@redhat.com>
e3ffab
---
e3ffab
 ipaserver/install/installutils.py | 8 +++++---
e3ffab
 1 file changed, 5 insertions(+), 3 deletions(-)
e3ffab
e3ffab
diff --git a/ipaserver/install/installutils.py b/ipaserver/install/installutils.py
e3ffab
index 0ab09abea03c8b317e7d00466e127cda00ed17d9..e40535d4822f603ea432094c85396c59222dbe5c 100644
e3ffab
--- a/ipaserver/install/installutils.py
e3ffab
+++ b/ipaserver/install/installutils.py
e3ffab
@@ -870,20 +870,22 @@ def stopped_service(service, instance_name=""):
e3ffab
                       'the next set of commands is being executed.', service,
e3ffab
                       log_instance_name)
e3ffab
 
e3ffab
+    service_obj = services.service(service)
e3ffab
+
e3ffab
     # Figure out if the service is running, if not, yield
e3ffab
-    if not services.knownservices[service].is_running(instance_name):
e3ffab
+    if not service_obj.is_running(instance_name):
e3ffab
         root_logger.debug('Service %s%s is not running, continue.', service,
e3ffab
                           log_instance_name)
e3ffab
         yield
e3ffab
     else:
e3ffab
         # Stop the service, do the required stuff and start it again
e3ffab
         root_logger.debug('Stopping %s%s.', service, log_instance_name)
e3ffab
-        services.knownservices[service].stop(instance_name)
e3ffab
+        service_obj.stop(instance_name)
e3ffab
         try:
e3ffab
             yield
e3ffab
         finally:
e3ffab
             root_logger.debug('Starting %s%s.', service, log_instance_name)
e3ffab
-            services.knownservices[service].start(instance_name)
e3ffab
+            service_obj.start(instance_name)
e3ffab
 
e3ffab
 def check_entropy():
e3ffab
     '''
e3ffab
-- 
e3ffab
2.1.0
e3ffab