From f3bddde927468277093288e0da91469800011155 Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Oct 16 2013 03:09:45 +0000 Subject: Update centos-art.sh scripts. - Previously, when no function definition was set in a module's initialization file, centos-art.sh script didn't report any error but a long output of function definitions. This update changes the tcar_setModuleEnvironmentScripts function to avoid the long output of function definitions and print an error message instead. --- diff --git a/Automation/Scripts/tcar_setModuleEnvironmentScripts.sh b/Automation/Scripts/tcar_setModuleEnvironmentScripts.sh index c575d08..270d246 100755 --- a/Automation/Scripts/tcar_setModuleEnvironmentScripts.sh +++ b/Automation/Scripts/tcar_setModuleEnvironmentScripts.sh @@ -60,6 +60,15 @@ function tcar_setModuleEnvironmentScripts { # Verify the execution rights for function file. tcar_checkFiles -ex ${TCAR_MODULE_SCRIPT} + # Retrieve the function's name from function's file. + local TCAR_MODULE_SCRIPT_FN=$(egrep "${FUNCTION_PATTERN}" ${TCAR_MODULE_SCRIPT} \ + | gawk '{ print $2 }') + + # Verify function's name. It cannot be an empty value. + if [[ -z "${TCAR_MODULE_SCRIPT_FN}" ]];then + tcar_printMessage "`gettext "No function definition found."`" --as-error-line + fi + # Verify that function files have not been already exported. # If they have been already exported don't export them again. # Instead, continue with the next function file in the list. @@ -71,10 +80,6 @@ function tcar_setModuleEnvironmentScripts { # Initialize the function file. . ${TCAR_MODULE_SCRIPT} - # Retrieve the function's name from function's file. - local TCAR_MODULE_SCRIPT_FN=$(egrep "${FUNCTION_PATTERN}" ${TCAR_MODULE_SCRIPT} \ - | gawk '{ print $2 }') - # Export the function names inside the file to current shell # script environment. export -f ${TCAR_MODULE_SCRIPT_FN}