[Freeipa-devel] [PATCH] ipactl can not restart ipa services if current status is stopped

2014-02-19 Thread Adam Misnyovszki
Hi,

fixed by starting the directory server in the beginning of restarting if it is 
not currently running to enable fetching running services, although former 
restart script didn't check that. Also added a check, that if the directory 
server started at the beginning, there is no need to restart it.

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

Thanks
Adam
From 5863e7a8e6296dabc5ed0d90f081b836bd37ab85 Mon Sep 17 00:00:00 2001
From: Misnyovszki Adam amisn...@redhat.com
Date: Wed, 19 Feb 2014 16:41:39 +0100
Subject: [PATCH] ipactl can not restart ipa services if current status is
 stopped

fixed by starting the directory server when restarting if it is not
currently running to enable fetching running services

later restart didn't check that

also added a check, that if the directory server started at the
beginning, there is no need to restart it

https://fedorahosted.org/freeipa/ticket/4050
---
 install/tools/ipactl | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/install/tools/ipactl b/install/tools/ipactl
index df0d6f57e5a862006f7266a04d36ccdb02bc17b7..3f5417464e62ec29e478d0dce981ca55a413b6ba 100755
--- a/install/tools/ipactl
+++ b/install/tools/ipactl
@@ -291,6 +291,15 @@ def ipa_stop(options):
 def ipa_restart(options):
 dirsrv = ipaservices.knownservices.dirsrv
 new_svc_list = []
+dirsrv_restart = True
+if not dirsrv.is_running():
+try:
+print Starting Directory Service
+dirsrv.start(capture_output=get_capture_output('dirsrv', options.debug))
+dirsrv_restart = False
+except Exception, e:
+raise IpactlError(Failed to start Directory Service:  + str(e))
+
 try:
 new_svc_list = get_config(dirsrv)
 except Exception, e:
@@ -339,8 +348,9 @@ def ipa_restart(options):
 emit_err(Failed to stop %s Service % svc)
 
 try:
-print Restarting Directory Service
-dirsrv.restart(capture_output=get_capture_output('dirsrv', options.debug))
+if dirsrv_restart:
+print Restarting Directory Service
+dirsrv.restart(capture_output=get_capture_output('dirsrv', options.debug))
 except Exception, e:
 emit_err(Failed to restart Directory Service:  + str(e))
 emit_err(Shutting down)
-- 
1.8.5.3

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

Re: [Freeipa-devel] [PATCH] ipactl can not restart ipa services if current status is stopped

2014-02-19 Thread Martin Kosek
On 02/19/2014 04:43 PM, Adam Misnyovszki wrote:
 Hi,
 
 fixed by starting the directory server in the beginning of restarting if it 
 is not currently running to enable fetching running services, although former 
 restart script didn't check that. Also added a check, that if the directory 
 server started at the beginning, there is no need to restart it.
 
 https://fedorahosted.org/freeipa/ticket/4050
 
 Thanks
 Adam

I think this is fine - works OK.

ACK, pushed to master.

Martin

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