diff --git a/acceptance/tests/resource/service/ticket_4123_should_list_all_running_redhat.sh b/acceptance/tests/resource/service/ticket_4123_should_list_all_running_redhat.sh index 1d5e49524..d8576667a 100755 --- a/acceptance/tests/resource/service/ticket_4123_should_list_all_running_redhat.sh +++ b/acceptance/tests/resource/service/ticket_4123_should_list_all_running_redhat.sh @@ -1,36 +1,29 @@ #!/bin/bash # A platform must be specified the only command line arg # This will facilitate expansion of this tests to include # the ability to test other OSes -#if [ -z $1 ] ; then -# echo "No platform specified" -# exit 1 -#fi +RALSH_FILE=/tmp/ralsh-running-list-$$ +SERVICE_FILE=/tmp/service-running-list-$$ -# redhat or centos only -#if echo $1 | grep -e centos -e redhat - RALSH_FILE=/tmp/ralsh-running-list-$$ - SERVICE_FILE=/tmp/service-running-list-$$ +puppet resource service | egrep -B1 "ensure.*=>.*'running" | grep 'service {' | gawk -F"'" '{print $2}' | sort > $RALSH_FILE - puppet resource service | egrep -B1 "ensure\s*=>\s*'running" | grep 'service {' | gawk -F"\'" '{print $2}' | sort > $RALSH_FILE +if [ -e $SERVICE_FILE ]; then + rm $SERVICE_FILE +fi - if [ -e $SERVICE_FILE ]; then - rm $SERVICE_FILE +SERVICEDIR='/etc/init.d' +for SERVICE in $( ls $SERVICEDIR | sort | egrep -v "(functions|halt|killall|single|linuxconf)" ) ; do + if env -i LANG="$LANG" PATH="$PATH" TERM="$TERM" "${SERVICEDIR}/${SERVICE}" status; then + echo $SERVICE >> $SERVICE_FILE fi - SERVICEDIR='/etc/init.d' - for SERVICE in $( ls $SERVICEDIR | sort | egrep -v "(functions|halt|killall|single|linuxconf)" ) ; do - if env -i LANG="$LANG" PATH="$PATH" TERM="$TERM" "${SERVICEDIR}/${SERVICE}" status; then - echo $SERVICE >> $SERVICE_FILE - fi - done +done - if diff $RALSH_FILE $SERVICE_FILE ; then - echo "Ralsh and system service count agree" - exit 0 - else - echo "Ralsh and system service count NOT in agreement" - exit 1 - fi -#fi # end redhat/centos +if diff $RALSH_FILE $SERVICE_FILE ; then + echo "Ralsh and system service count agree" + exit 0 +else + echo "Ralsh and system service count NOT in agreement" + exit 1 +fi diff --git a/acceptance/tests/resource/service/ticket_4124_should_list_all_disabled.sh b/acceptance/tests/resource/service/ticket_4124_should_list_all_disabled.sh index 7cc463d5e..7e884aff2 100755 --- a/acceptance/tests/resource/service/ticket_4124_should_list_all_disabled.sh +++ b/acceptance/tests/resource/service/ticket_4124_should_list_all_disabled.sh @@ -1,37 +1,29 @@ #!/bin/bash # A platform must be specified the only command line arg # This will facilitate expansion of this tests to include # the ability to test other OSes -#if [ -z $1 ] ; then -# echo "No platform specified" -# exit 1 -#fi +RALSH_FILE=/tmp/ralsh-disabled-list-$$ +SERVICE_FILE=/tmp/service-disabled-list-$$ -# redhat or centos only -#if echo $1 | grep -e centos -e redhat - RALSH_FILE=/tmp/ralsh-disabled-list-$$ - SERVICE_FILE=/tmp/service-disabled-list-$$ +puppet resource service | egrep -B2 "enable.*=>.*'false" | grep "service {" | awk -F"'" '{print $2}' | sort > $RALSH_FILE - # collect all service namevars - puppet resource service | egrep -B2 "enable\s*=>\s*'false" | grep "service {" | awk -F"'" '{print $2}' | sort > $RALSH_FILE +if [ -e $SERVICE_FILE ]; then + rm $SERVICE_FILE +fi - if [ -e $SERVICE_FILE ]; then - rm $SERVICE_FILE +SERVICEDIR='/etc/init.d' +for SERVICE in $( ls $SERVICEDIR | sort | egrep -v "(functions|halt|killall|single|linuxconf)" ) ; do + if ! chkconfig $SERVICE; then + echo $SERVICE >> $SERVICE_FILE fi - SERVICEDIR='/etc/init.d' - for SERVICE in $( ls $SERVICEDIR | sort | egrep -v "(functions|halt|killall|single|linuxconf)" ) ; do - if ! chkconfig $SERVICE; then - echo $SERVICE >> $SERVICE_FILE - fi - done +done - if diff $RALSH_FILE $SERVICE_FILE ; then - echo "Ralsh and system service count agree" - exit 0 - else - echo "Ralsh and system service count NOT in agreement" - exit 1 - fi -#fi # end redhat/centos +if diff $RALSH_FILE $SERVICE_FILE ; then + echo "Ralsh and system service count agree" + exit 0 +else + echo "Ralsh and system service count NOT in agreement" + exit 1 +fi