refactoring: log_event(), is_format_valid()

This commit is contained in:
Serghey Rodin 2016-06-09 16:31:56 +03:00
commit e05dca61a6
211 changed files with 756 additions and 1091 deletions

View file

@ -20,7 +20,7 @@ source $VESTA/conf/vesta.conf
is_file_available() {
if [ ! -e "$vfile" ]; then
echo "Error: file $vfile doesn't exist"
log_event "$E_NOTEXIST" "$EVENT"
log_event "$E_NOTEXIST" "$ARGUMENTS"
exit $E_NOTEXIST
fi
}
@ -30,7 +30,7 @@ is_file_valid() {
vcontent=$(cat $vfile)
if [[ "$vcontent" =~ $exclude ]]; then
echo "Error: invalid characters in the exlusion list"
log_event "$E_INVALID" "$EVENT"
log_event "$E_INVALID" "$ARGUMENTS"
exit $E_INVALID
fi
}
@ -41,7 +41,7 @@ is_file_valid() {
#----------------------------------------------------------#
check_args '2' "$#" 'USER FILE'
validate_format 'user' 'vfile'
is_format_valid 'user' 'vfile'
is_object_valid 'user' 'USER' "$user"
is_file_available
is_file_valid
@ -78,6 +78,6 @@ chmod 660 $USER_DATA/backup-excludes.conf
# Logging
log_history "updated exlusion list"
log_event "$OK" "$EVENT"
log_event "$OK" "$ARGUMENTS"
exit