sssd-lib.sh: Use lib to restart sssd service
PATCH 1/2 sssd-lib.sh: Use lib to restart sssd service
Use restart_daemon() to restart sssd service.
--- testcases/commands/sssd/sssd-lib.sh | 41 +++---------------------------------- 1 file changed, 3 insertions(+), 38 deletions(-)
testcases/commands/sssd/sssd-lib.sh +3 -38
@@ -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"
Signature · 13 lines
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 [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
PATCH 2/2 sssd-lib.sh: fix a bug of sssd daemon is not started
If sssd daemon is not started, sssd daemon should be kept stopped.
--- testcases/commands/sssd/sssd-lib.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
testcases/commands/sssd/sssd-lib.sh +11 -1
@@ -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
Signature · 13 lines
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 [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Wanlong Gao
AppliedRe: [LTP] [PATCH 2/2] sssd-lib.sh: fix a bug of sssd daemon is not started
Quoted 3 lines · Peng Haitao
If sssd daemon is not started, sssd daemon should be kept stopped.
Signed-off-by Peng Haitao <[email protected]>
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Wanlong Gao
AppliedQuoted 3 lines · Peng Haitao
Use
restart_daemon()to restart sssd service.Signed-off-by Peng Haitao <[email protected]>
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list