All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] sssd-lib.sh: Use lib to restart sssd service
@ 2013-07-09  8:36 Peng Haitao
  2013-07-09  8:36 ` [LTP] [PATCH 2/2] sssd-lib.sh: fix a bug of sssd daemon is not started Peng Haitao
  2013-07-10  2:01 ` [LTP] [PATCH 1/2] sssd-lib.sh: Use lib to restart sssd service Wanlong Gao
  0 siblings, 2 replies; 4+ messages in thread
From: Peng Haitao @ 2013-07-09  8:36 UTC (permalink / raw)
  To: ltp-list

Use restart_daemon() to restart sssd service.

Signed-off-by: Peng Haitao <penght@cn.fujitsu.com>
---
 testcases/commands/sssd/sssd-lib.sh | 41 +++----------------------------------
 1 file changed, 3 insertions(+), 38 deletions(-)

diff --git a/testcases/commands/sssd/sssd-lib.sh b/testcases/commands/sssd/sssd-lib.sh
index e434efe..b001904 100755
--- a/testcases/commands/sssd/sssd-lib.sh
+++ b/testcases/commands/sssd/sssd-lib.sh
@@ -39,21 +39,10 @@ readonly TRAP_SIGS="2 3 6 11 15"
 
 CONFIG_FILE="/etc/sssd/sssd.conf"
 NSS_CONFIG_FILE="/etc/nsswitch.conf"
-SSSD_INIT_SCRIPT="/etc/init.d/sssd"
-
-# Command to restart sssd daemon.
-SSSD_RESTART_CMD=
 
 # number of seconds to wait for another sssd test to complete
 WAIT_COUNT=30
 
-# running under systemd?
-if command -v systemctl >/dev/null 2>&1; then
-	HAVE_SYSTEMCTL=1
-else
-	HAVE_SYSTEMCTL=0
-fi
-
 cleanup()
 {
 	disable_traps
@@ -98,30 +87,6 @@ setup()
 		cleanup	0
 	fi
 
-	SVCNAME=$(basename $SSSD_INIT_SCRIPT)
-	if [ $HAVE_SYSTEMCTL == 1 ]; then
-		for svc in "$SVCNAME" "sssd"; do
-			if systemctl is-enabled $svc.service >/dev/null 2>&1
-			then
-				SSSD_RESTART_CMD="systemctl restart $svc.service"
-				break
-			fi
-		done
-	else
-		for SSSD_INIT_SCRIPT in "$SSSD_INIT_SCRIPT" "/etc/init.d/sssd"
-		do
-			if [ -x "$SSSD_INIT_SCRIPT" ]; then
-				SSSD_RESTART_CMD="$SSSD_INIT_SCRIPT restart"
-				break
-			fi
-		done
-	fi
-
-	if [ -z "$SSSD_RESTART_CMD" ]; then
-		tst_resm TBROK "Don't know how to restart $SVCNAME"
-		cleanup 1
-	fi
-
 	# Back up configuration file
 	if [ -f "$CONFIG_FILE" ]; then
 		# Pause if another LTP sssd test is running
@@ -163,8 +128,8 @@ restart_sssd_daemon()
 		cleanup_command=$1
 	fi
 
-	tst_resm TINFO "restarting sssd daemon via $SSSD_RESTART_CMD"
-	$SSSD_RESTART_CMD > /dev/null 2>&1
+	tst_resm TINFO "restarting sssd daemon"
+	restart_daemon sssd
 	if [ $? -eq 0 ]; then
 		# wait sssd restart success.
 		sleep 1
@@ -201,7 +166,7 @@ make_config_file
 sed -i -e "/\[domain\/LOCAL\]/ a\override_gid = error" $CONFIG_FILE
 # make sure config file is OK
 sleep 1
-$SSSD_RESTART_CMD > /dev/null 2>&1
+restart_daemon sssd
 
 if [ $? -ne 1 ]; then
 	tst_resm TCONF "override_gid does not exist. Skipping all testcases"
-- 
1.8.3.1


------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [LTP] [PATCH 2/2] sssd-lib.sh: fix a bug of sssd daemon is not started
  2013-07-09  8:36 [LTP] [PATCH 1/2] sssd-lib.sh: Use lib to restart sssd service Peng Haitao
@ 2013-07-09  8:36 ` Peng Haitao
  2013-07-10  2:01   ` Wanlong Gao
  2013-07-10  2:01 ` [LTP] [PATCH 1/2] sssd-lib.sh: Use lib to restart sssd service Wanlong Gao
  1 sibling, 1 reply; 4+ messages in thread
From: Peng Haitao @ 2013-07-09  8:36 UTC (permalink / raw)
  To: ltp-list

If sssd daemon is not started, sssd daemon should be kept stopped.

Signed-off-by: Peng Haitao <penght@cn.fujitsu.com>
---
 testcases/commands/sssd/sssd-lib.sh | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/testcases/commands/sssd/sssd-lib.sh b/testcases/commands/sssd/sssd-lib.sh
index b001904..d63ed6d 100755
--- a/testcases/commands/sssd/sssd-lib.sh
+++ b/testcases/commands/sssd/sssd-lib.sh
@@ -54,7 +54,11 @@ cleanup()
 			mv $NSS_CONFIG_FILE.ltpback $NSS_CONFIG_FILE
 			# Make sure that restart_sssd_daemon doesn't loop
 			# back to cleanup again.
-			restart_sssd_daemon "return 1"
+			if [ $SSSD_STARTED -eq 1 ]; then
+				stop_daemon sssd
+			else
+				restart_sssd_daemon "return 1"
+			fi
 			# Maintain any nonzero exit codes
 			if [ $exit_code -ne $? ]; then
 				exit_code=1
@@ -160,6 +164,12 @@ make_config_file()
 
 . cmdlib.sh
 
+SSSD_STARTED=0
+status_daemon sssd
+if [ $? -ne 0 ]; then
+	SSSD_STARTED=1
+fi
+
 # determine sssd.conf can support override_gid?
 setup
 make_config_file
-- 
1.8.3.1


------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [LTP] [PATCH 1/2] sssd-lib.sh: Use lib to restart sssd service
  2013-07-09  8:36 [LTP] [PATCH 1/2] sssd-lib.sh: Use lib to restart sssd service Peng Haitao
  2013-07-09  8:36 ` [LTP] [PATCH 2/2] sssd-lib.sh: fix a bug of sssd daemon is not started Peng Haitao
@ 2013-07-10  2:01 ` Wanlong Gao
  1 sibling, 0 replies; 4+ messages in thread
From: Wanlong Gao @ 2013-07-10  2:01 UTC (permalink / raw)
  To: Peng Haitao; +Cc: ltp-list

On 07/09/2013 04:36 PM, Peng Haitao wrote:
> Use restart_daemon() to restart sssd service.
> 
> Signed-off-by: Peng Haitao <penght@cn.fujitsu.com>

Applied, thank you.

Wanlong Gao


------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [LTP] [PATCH 2/2] sssd-lib.sh: fix a bug of sssd daemon is not started
  2013-07-09  8:36 ` [LTP] [PATCH 2/2] sssd-lib.sh: fix a bug of sssd daemon is not started Peng Haitao
@ 2013-07-10  2:01   ` Wanlong Gao
  0 siblings, 0 replies; 4+ messages in thread
From: Wanlong Gao @ 2013-07-10  2:01 UTC (permalink / raw)
  To: Peng Haitao; +Cc: ltp-list

On 07/09/2013 04:36 PM, Peng Haitao wrote:
> If sssd daemon is not started, sssd daemon should be kept stopped.
> 
> Signed-off-by: Peng Haitao <penght@cn.fujitsu.com>

Applied, thank you.

Wanlong Gao


------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-07-10  2:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-09  8:36 [LTP] [PATCH 1/2] sssd-lib.sh: Use lib to restart sssd service Peng Haitao
2013-07-09  8:36 ` [LTP] [PATCH 2/2] sssd-lib.sh: fix a bug of sssd daemon is not started Peng Haitao
2013-07-10  2:01   ` Wanlong Gao
2013-07-10  2:01 ` [LTP] [PATCH 1/2] sssd-lib.sh: Use lib to restart sssd service Wanlong Gao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.