forked from outroll/vesta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_json_listing.sh
executable file
·57 lines (50 loc) · 1.35 KB
/
test_json_listing.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
source /etc/profile.d/vesta.sh
V_BIN="$VESTA/bin"
V_TEST="$VESTA/test"
commands='v_list_cron_jobs admin json
v_list_databases admin json
v_list_database admin admin_vesta json
v_list_database_server mysql localhost json
v_list_database_servers mysql json
v_list_dns_domains admin json
v_list_mail_domains admin json
v_list_dns_templates json
v_list_mail_domains admin json
v_list_sys_config json
v_list_sys_interfaces json
v_list_sys_ips json
v_list_sys_rrd json
v_list_user admin json
v_list_user_backups admin json
v_list_user_ips admin json
v_list_user_ns admin json
v_list_user_packages json
v_list_users json
v_list_web_domains admin json
v_list_web_domain admin default.vesta.domain json
v_list_web_templates admin json
v_list_web_templates_nginx admin json'
IFS=$'\n'
for cmd in $commands; do
script=$(echo $cmd |cut -f 1 -d ' ')
arg1=$(echo $cmd |cut -f 2 -d ' ')
arg2=$(echo $cmd |cut -f 3 -d ' ')
arg3=$(echo $cmd |cut -f 4 -d ' ')
$V_BIN/$script $arg1 $arg2 $arg3 | $V_TEST/json.sh >/dev/null 2>/dev/null
retval="$?"
echo -en "$cmd"
echo -en '\033[60G'
echo -n '['
if [ "$retval" -ne 0 ]; then
echo -n 'FAILED'
echo -n ']'
echo -ne '\r\n'
$V_BIN/$script $arg1 $arg2 $arg3 | $V_TEST/json.sh
else
echo -n ' OK '
echo -n ']'
fi
echo -ne '\r\n'
done
exit