Browse Source
refactor: improve logging and error handling in install_config.sh
- Refactored the code to use more descriptive function names.
- Improved logging by using fn_print_ok_eol and fn_print_failure_eol functions.
- Added error handling for copying config files, displaying failure messages if necessary.
- Updated comments for better clarity.
feature/dst-changes
Daniel Gibbs
2 years ago
No known key found for this signature in database
GPG Key ID: 2076B128385E8C55
1 changed files with
10 additions and
4 deletions
lgsm/modules/install_config.sh
@ -58,10 +58,10 @@ fn_default_config_remote() {
exitcode = $?
exitcode = $?
fi
fi
if [ " ${ exitcode } " != 0 ] ; then
if [ " ${ exitcode } " != 0 ] ; then
fn_print_failure_n l
fn_print_failure_eo l
fn_script_log_fatal " copying config file ${ servercfg } . "
fn_script_log_fatal " copying config file ${ servercfg } . "
else
else
fn_print_ok_n l
fn_print_ok_eo l
fn_script_log_pass " copying config file ${ servercfg } . "
fn_script_log_pass " copying config file ${ servercfg } . "
fi
fi
done
done
@ -70,9 +70,15 @@ fn_default_config_remote() {
# Copys local default config to server config location.
# Copys local default config to server config location.
fn_default_config_local( ) {
fn_default_config_local( ) {
echo -e " copying ${ servercfgdefault } config file. "
echo -e " copying config file [ ${ servercfgdefault } ] "
cp -nv " ${ servercfgdir } / ${ servercfgdefault } " " ${ servercfgfullpath } "
cp -nv " ${ servercfgdir } / ${ servercfgdefault } " " ${ servercfgfullpath } "
fn_sleep_time
if [ " ${ exitcode } " != 0 ] ; then
fn_print_failure_eol
fn_script_log_fatal " copying config file [ ${ servercfgdefault } ] "
else
fn_print_ok_eol
fn_script_log_pass " copying config file [ ${ servercfgdefault } ] "
fi
}
}
# Changes some variables within the default configs.
# Changes some variables within the default configs.