dns template listing

This commit is contained in:
Serghey Rodin 2011-09-21 12:42:13 +03:00
commit 742dfbec28

59
bin/v_list_dns_template Executable file
View file

@ -0,0 +1,59 @@
#!/bin/bash
# info: listing dns template
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument defenition
template="$1"
format="${2-shell}"
limit="${3-1000}"
offset="${4-1}"
# Importing variables
source $VESTA/conf/vars.conf
source $V_FUNC/shared_func.sh
source $V_FUNC/domain_func.sh
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
# Checking args
check_args '1' "$#" 'template [format]'
# Checking argument format
format_validation 'template'
# Checking template
is_template_valid 'dns'
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Defining config
conf="$V_DNSTPL/$template.tpl"
# Defining fileds to select
fields='$RECORD $TYPE $VALUE'
# Listing domains
case $format in
json) dns_json_list ;;
shell) dns_shell_list | column -t ;;
*) check_args '1' "0" 'template [format]'
esac
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Logging
log_event 'system' "$V_EVENT"
exit $OK