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

@ -24,11 +24,11 @@ source $VESTA/conf/vesta.conf
#----------------------------------------------------------#
check_args '2' "$#" 'IP IP_STATUS'
validate_format 'ip' 'ip_status'
is_format_valid 'ip' 'ip_status'
is_ip_valid
if [ "$ip_status" = "$(get_ip_value '$STATUS')" ]; then
echo "Error: status $ip_status is already set"
log_event "$E_EXISTS" "$EVENT"
log_event "$E_EXISTS" "$ARGUMENTS"
exit $E_EXISTS
fi
@ -37,7 +37,7 @@ sys_user=$(get_ip_value '$U_SYS_USERS')
ip_owner=$(get_ip_value '$OWNER')
if [ "$web_domains" -ne '0' ] && [ "$sys_user" != "$ip_owner" ]; then
echo "Error: ip $ip is used"
log_event "$E_INUSE" "$EVENT"
log_event "$E_INUSE" "$ARGUMENTS"
exit $E_INUSE
fi
@ -56,6 +56,6 @@ update_ip_value '$STATUS' "$ip_status"
# Logging
log_history "changed $ip status to $ip_status" '' 'admin'
log_event "$OK" "$EVENT"
log_event "$OK" "$ARGUMENTS"
exit