Re: [Freeipa-devel] [PATCH] 0025 Always stop dirsrv in 'ipactl stop'
Rob Crittenden wrote: Ana Krivokapic wrote: On 04/26/2013 04:03 PM, Petr Viktorin wrote: On 04/26/2013 03:03 PM, Ana Krivokapic wrote: Ensure that 'ipactl stop' stops the dirsrv instance, even when no other services are running. https://fedorahosted.org/freeipa/ticket/3574 Thanks for the patch. It solves the problem, but when I look at the `if len(svc_list) == 0:` block, I see it only protects the os.unlink at the bottom against the case where there file doesn't exist. I think the code would be more straightforward if you removed the `if` block entirely, and wrapped a try/except around the unlink call. Agreed, updated patch attached. Works for me. Postponing push until Monday as some of the hosted services are down for maintenance. rob pushed to master ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
Re: [Freeipa-devel] [PATCH] 0025 Always stop dirsrv in 'ipactl stop'
Ana Krivokapic wrote: On 04/26/2013 04:03 PM, Petr Viktorin wrote: On 04/26/2013 03:03 PM, Ana Krivokapic wrote: Ensure that 'ipactl stop' stops the dirsrv instance, even when no other services are running. https://fedorahosted.org/freeipa/ticket/3574 Thanks for the patch. It solves the problem, but when I look at the `if len(svc_list) == 0:` block, I see it only protects the os.unlink at the bottom against the case where there file doesn't exist. I think the code would be more straightforward if you removed the `if` block entirely, and wrapped a try/except around the unlink call. Agreed, updated patch attached. Works for me. Postponing push until Monday as some of the hosted services are down for maintenance. rob ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
Re: [Freeipa-devel] [PATCH] 0025 Always stop dirsrv in 'ipactl stop'
On 04/26/2013 04:03 PM, Petr Viktorin wrote: > On 04/26/2013 03:03 PM, Ana Krivokapic wrote: >> Ensure that 'ipactl stop' stops the dirsrv instance, even when no other >> services are running. >> >> https://fedorahosted.org/freeipa/ticket/3574 > > Thanks for the patch. It solves the problem, but when I look at the > `if len(svc_list) == 0:` block, I see it only protects the os.unlink > at the bottom against the case where there file doesn't exist. > I think the code would be more straightforward if you removed the `if` > block entirely, and wrapped a try/except around the unlink call. > Agreed, updated patch attached. -- Regards, Ana Krivokapic Associate Software Engineer FreeIPA team Red Hat Inc. From f2882303d8856ce3e18ccad5869c4f941db235ea Mon Sep 17 00:00:00 2001 From: Ana Krivokapic Date: Fri, 26 Apr 2013 14:46:17 +0200 Subject: [PATCH] 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(-) diff --git a/install/tools/ipactl b/install/tools/ipactl index 6500c274c446155987a8aefde7265d4d5f7a732a..2d699880ccf818cc33802994aa10bbd10e4c8851 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): -- 1.8.1.4 ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
Re: [Freeipa-devel] [PATCH] 0025 Always stop dirsrv in 'ipactl stop'
On 04/26/2013 03:03 PM, Ana Krivokapic wrote: Ensure that 'ipactl stop' stops the dirsrv instance, even when no other services are running. https://fedorahosted.org/freeipa/ticket/3574 Thanks for the patch. It solves the problem, but when I look at the `if len(svc_list) == 0:` block, I see it only protects the os.unlink at the bottom against the case where there file doesn't exist. I think the code would be more straightforward if you removed the `if` block entirely, and wrapped a try/except around the unlink call. -- PetrĀ³ ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
[Freeipa-devel] [PATCH] 0025 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 -- Regards, Ana Krivokapic Associate Software Engineer FreeIPA team Red Hat Inc. From 800c17eaf3a8c5e6a9e8af7c13fa8ecfe8088592 Mon Sep 17 00:00:00 2001 From: Ana Krivokapic Date: Fri, 26 Apr 2013 14:46:17 +0200 Subject: [PATCH] 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 | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/install/tools/ipactl b/install/tools/ipactl index 6500c274c446155987a8aefde7265d4d5f7a732a..cab1127b7be2177f6bad0351a8f793f671891edf 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,6 +269,12 @@ def ipa_stop(options): finally: raise IpactlError() +try: +print "Stopping Directory Service" +dirsrv.stop(capture_output=False) +except: +raise IpactlError("Failed to stop Directory Service") + if len(svc_list) == 0: # no service to stop return @@ -282,12 +287,6 @@ 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) -- 1.8.1.4 ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel