From dfcdd9c403be81e81c88e7f6644394ee1bef14f3 Mon Sep 17 00:00:00 2001 From: Ana Krivokapic Date: Fri, 26 Apr 2013 14:46:17 +0200 Subject: Always stop dirsrv in 'ipactl stop' Ensure that 'ipactl stop' stops the dirsrv instance, even when no other services are running. https://fedorahosted.org/freeipa/ticket/3574 --- install/tools/ipactl | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'install/tools/ipactl') diff --git a/install/tools/ipactl b/install/tools/ipactl index 6500c274c..2d699880c 100755 --- a/install/tools/ipactl +++ b/install/tools/ipactl @@ -252,7 +252,6 @@ def ipa_start(options): def ipa_stop(options): dirsrv = ipaservices.knownservices.dirsrv - svc_list = [] try: svc_list = get_config_from_file() except Exception, e: @@ -270,9 +269,11 @@ def ipa_stop(options): finally: raise IpactlError() - if len(svc_list) == 0: - # no service to stop - return + try: + print "Stopping Directory Service" + dirsrv.stop(capture_output=False) + except: + raise IpactlError("Failed to stop Directory Service") for svc in reversed(svc_list): svchandle = ipaservices.service(svc) @@ -282,14 +283,11 @@ def ipa_stop(options): except: emit_err("Failed to stop %s Service" % svc) - try: - print "Stopping Directory Service" - dirsrv.stop(capture_output=False) - except: - raise IpactlError("Failed to stop Directory Service") - # remove file with list of started services - os.unlink(ipaservices.SVC_LIST_FILE) + try: + os.unlink(ipaservices.SVC_LIST_FILE) + except OSError: + pass def ipa_restart(options): -- cgit