Skip to content

Commit 742dfbe

Browse files
committed
dns template listing
1 parent 472494b commit 742dfbe

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

bin/v_list_dns_template

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/bash
2+
# info: listing dns template
3+
4+
#----------------------------------------------------------#
5+
# Variable&Function #
6+
#----------------------------------------------------------#
7+
8+
# Argument defenition
9+
template="$1"
10+
format="${2-shell}"
11+
limit="${3-1000}"
12+
offset="${4-1}"
13+
14+
# Importing variables
15+
source $VESTA/conf/vars.conf
16+
source $V_FUNC/shared_func.sh
17+
source $V_FUNC/domain_func.sh
18+
19+
20+
#----------------------------------------------------------#
21+
# Verifications #
22+
#----------------------------------------------------------#
23+
24+
# Checking args
25+
check_args '1' "$#" 'template [format]'
26+
27+
# Checking argument format
28+
format_validation 'template'
29+
30+
# Checking template
31+
is_template_valid 'dns'
32+
33+
34+
#----------------------------------------------------------#
35+
# Action #
36+
#----------------------------------------------------------#
37+
38+
# Defining config
39+
conf="$V_DNSTPL/$template.tpl"
40+
41+
# Defining fileds to select
42+
fields='$RECORD $TYPE $VALUE'
43+
44+
# Listing domains
45+
case $format in
46+
json) dns_json_list ;;
47+
shell) dns_shell_list | column -t ;;
48+
*) check_args '1' "0" 'template [format]'
49+
esac
50+
51+
52+
#----------------------------------------------------------#
53+
# Vesta #
54+
#----------------------------------------------------------#
55+
56+
# Logging
57+
log_event 'system' "$V_EVENT"
58+
59+
exit $OK

0 commit comments

Comments
 (0)