diff --git a/README.rst b/README.rst index 8c36162..79048f5 100644 --- a/README.rst +++ b/README.rst @@ -281,6 +281,18 @@ In order to install salt for a distribution you need to define: daemons_running [THIS ONE IS ALREADY DEFINED AS THE DEFAULT] +8. Optionally, check enabled Services: + +.. code:: bash + + install____check_services + install_____check_services + install___check_services + install____check_services + install___check_services + install__check_services + + ---- Below is an example for Ubuntu Oneiric(the example may not be up to date with the script): diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 9026adc..60fdefb 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -13,7 +13,7 @@ # details. # # LICENSE: Apache 2.0 -# ORGANIZATION: Salt Stack (saltstack.org) +# ORGANIZATION: SaltStack (saltstack.org) # CREATED: 10/15/2012 09:49:37 PM WEST #=============================================================================== set -o nounset # Treat unset variables as an error @@ -1319,6 +1319,15 @@ movefile() { # 5. daemons_running__ # 6. daemons_running_ # 7. daemons_running [THIS ONE IS ALREADY DEFINED AS THE DEFAULT] +# +# Optionally, check enabled Services: +# 1. install____check_services +# 2. install_____check_services +# 3. install___check_services +# 4 install____check_services +# 5. install___check_services +# 6. install__check_services +# ############################################################################## @@ -3640,7 +3649,6 @@ POST_FUNC_NAMES="$POST_FUNC_NAMES install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJO POST_FUNC_NAMES="$POST_FUNC_NAMES install_${DISTRO_NAME_L}_${ITYPE}_post" POST_FUNC_NAMES="$POST_FUNC_NAMES install_${DISTRO_NAME_L}_post" - POST_INSTALL_FUNC="null" for FUNC_NAME in $(__strip_duplicates $POST_FUNC_NAMES); do if __function_defined $FUNC_NAME; then @@ -3650,6 +3658,7 @@ for FUNC_NAME in $(__strip_duplicates $POST_FUNC_NAMES); do done echodebug "POST_INSTALL_FUNC=${POST_INSTALL_FUNC}" + # Let's get the start daemons install function STARTDAEMONS_FUNC_NAMES="install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}_${ITYPE}_restart_daemons" STARTDAEMONS_FUNC_NAMES="$STARTDAEMONS_FUNC_NAMES install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}${PREFIXED_DISTRO_MINOR_VERSION}_${ITYPE}_restart_daemons" @@ -3669,6 +3678,7 @@ for FUNC_NAME in $(__strip_duplicates $STARTDAEMONS_FUNC_NAMES); do done echodebug "STARTDAEMONS_INSTALL_FUNC=${STARTDAEMONS_INSTALL_FUNC}" + # Let's get the daemons running check function. DAEMONS_RUNNING_FUNC="null" DAEMONS_RUNNING_FUNC_NAMES="daemons_running_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}_${ITYPE}" @@ -3689,6 +3699,23 @@ for FUNC_NAME in $(__strip_duplicates $DAEMONS_RUNNING_FUNC_NAMES); do done echodebug "DAEMONS_RUNNING_FUNC=${DAEMONS_RUNNING_FUNC}" +# Let's get the check services function +CHECK_SERVICES_FUNC_NAMES="install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}_${ITYPE}_check_services" +CHECK_SERVICES_FUNC_NAMES="$POST_FUNC_NAMES install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}${PREFIXED_DISTRO_MINOR_VERSION}_${ITYPE}_check_services" +CHECK_SERVICES_FUNC_NAMES="$POST_FUNC_NAMES install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}_check_services" +CHECK_SERVICES_FUNC_NAMES="$POST_FUNC_NAMES install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}${PREFIXED_DISTRO_MINOR_VERSION}_check_services" +CHECK_SERVICES_FUNC_NAMES="$POST_FUNC_NAMES install_${DISTRO_NAME_L}_${ITYPE}_check_services" +CHECK_SERVICES_FUNC_NAMES="$POST_FUNC_NAMES install_${DISTRO_NAME_L}_check_services" + +CHECK_SERVICES_FUNC="null" +for FUNC_NAME in $(__strip_duplicates $CHECK_SERVICES_FUNC_NAMES); do + if __function_defined $FUNC_NAME; then + CHECK_SERVICES_FUNC=$FUNC_NAME + break + fi +done +echodebug "CHECK_SERVICES_FUNC=${CHECK_SERVICES_FUNC}" + if [ $DEPS_INSTALL_FUNC = "null" ]; then echoerror "No dependencies installation function found. Exiting..." @@ -3755,7 +3782,6 @@ if [ $_INSTALL_MINION -eq $BS_TRUE ]; then fi fi - # Drop the master address if passed if [ $_SALT_MASTER_ADDRESS != "null" ]; then [ ! -d $_SALT_ETC_DIR/minion.conf.d ] && mkdir -p $_SALT_ETC_DIR/minion.conf.d @@ -3764,8 +3790,7 @@ master: $_SALT_MASTER_ADDRESS _eof fi - -# Run any post install function, Only execute function is not in config mode only +# Run any post install function. Only execute function if not in config mode only if [ $_CONFIG_ONLY -eq $BS_FALSE ] && [ "$POST_INSTALL_FUNC" != "null" ]; then echoinfo "Running ${POST_INSTALL_FUNC}()" $POST_INSTALL_FUNC @@ -3775,6 +3800,16 @@ if [ $_CONFIG_ONLY -eq $BS_FALSE ] && [ "$POST_INSTALL_FUNC" != "null" ]; then fi fi +# Run any check services function, Only execute function if not in config mode only +if [ $_CONFIG_ONLY -eq $BS_FALSE ] && [ "$CHECK_SERVICES_FUNC" != "null" ]; then + echoinfo "Running ${CHECK_SERVICES_FUNC}()" + $CHECK_SERVICES_FUNC + if [ $? -ne 0 ]; then + echoerror "Failed to run ${CHECK_SERVICES_FUNC}()!!!" + exit 1 + fi +fi + # Run any start daemons function if [ "$STARTDAEMONS_INSTALL_FUNC" != "null" ]; then