|
Lines 36-59
show_instances()
Link Here
|
| 36 |
for instance in $( get_instances ); do |
36 |
for instance in $( get_instances ); do |
| 37 |
case $show in |
37 |
case $show in |
| 38 |
"all") |
38 |
"all") |
| 39 |
if instance_filter_email $instance $show_email && \ |
39 |
if instance_filter_email $instance $show_email && \ |
| 40 |
instance_filter_plack $instance $show_plack && \ |
40 |
instance_filter_letsencrypt $instance $show_letsencrypt && \ |
| 41 |
instance_filter_sip $instance $show_sip; then |
41 |
instance_filter_plack $instance $show_plack && \ |
|
|
42 |
instance_filter_sip $instance $show_sip; then |
| 42 |
echo $instance |
43 |
echo $instance |
| 43 |
fi ;; |
44 |
fi ;; |
| 44 |
"enabled") |
45 |
"enabled") |
| 45 |
if is_enabled $instance; then |
46 |
if is_enabled $instance; then |
| 46 |
if instance_filter_email $instance $show_email && \ |
47 |
if instance_filter_email $instance $show_email && \ |
| 47 |
instance_filter_plack $instance $show_plack && \ |
48 |
instance_filter_letsencrypt $instance $show_letsencrypt && \ |
| 48 |
instance_filter_sip $instance $show_sip; then |
49 |
instance_filter_plack $instance $show_plack && \ |
|
|
50 |
instance_filter_sip $instance $show_sip; then |
| 49 |
echo $instance |
51 |
echo $instance |
| 50 |
fi |
52 |
fi |
| 51 |
fi ;; |
53 |
fi ;; |
| 52 |
"disabled") |
54 |
"disabled") |
| 53 |
if ! is_enabled $instance; then |
55 |
if ! is_enabled $instance; then |
| 54 |
if instance_filter_email $instance $show_email && \ |
56 |
if instance_filter_email $instance $show_email && \ |
| 55 |
instance_filter_plack $instance $show_plack && \ |
57 |
instance_filter_letsencrypt $instance $show_letsencrypt && \ |
| 56 |
instance_filter_sip $instance $show_sip; then |
58 |
instance_filter_plack $instance $show_plack && \ |
|
|
59 |
instance_filter_sip $instance $show_sip; then |
| 57 |
echo $instance |
60 |
echo $instance |
| 58 |
fi |
61 |
fi |
| 59 |
fi ;; |
62 |
fi ;; |
|
Lines 106-111
instance_filter_plack()
Link Here
|
| 106 |
return 1 |
109 |
return 1 |
| 107 |
} |
110 |
} |
| 108 |
|
111 |
|
|
|
112 |
instance_filter_letsencrypt() |
| 113 |
{ |
| 114 |
local instancename=$1 |
| 115 |
local show_letsencrypt=$2; |
| 116 |
|
| 117 |
case $show_letsencrypt in |
| 118 |
"all") |
| 119 |
return 0 ;; |
| 120 |
"enabled") |
| 121 |
if is_letsencrypt_enabled $instancename; then |
| 122 |
return 0 |
| 123 |
fi ;; |
| 124 |
"disabled") |
| 125 |
if ! is_letsencrypt_enabled $instancename; then |
| 126 |
return 0 |
| 127 |
fi ;; |
| 128 |
esac |
| 129 |
|
| 130 |
# Didn't match any criteria |
| 131 |
return 1 |
| 132 |
} |
| 133 |
|
| 109 |
instance_filter_email() |
134 |
instance_filter_email() |
| 110 |
{ |
135 |
{ |
| 111 |
local instancename=$1 |
136 |
local instancename=$1 |
|
Lines 150-155
set_show_email()
Link Here
|
| 150 |
fi |
175 |
fi |
| 151 |
} |
176 |
} |
| 152 |
|
177 |
|
|
|
178 |
set_show_letsencrypt() |
| 179 |
{ |
| 180 |
local letsencrypt_param=$1 |
| 181 |
|
| 182 |
if [ "$show_letsencrypt" = "all" ]; then |
| 183 |
show_letsencrypt=$letsencrypt_param |
| 184 |
else |
| 185 |
die "Error: --letsencrypt and --noletsencrypt are mutually exclusive." |
| 186 |
fi |
| 187 |
} |
| 188 |
|
| 153 |
set_show_plack() |
189 |
set_show_plack() |
| 154 |
{ |
190 |
{ |
| 155 |
local plack_param=$1 |
191 |
local plack_param=$1 |
|
Lines 190-195
Options:
Link Here
|
| 190 |
--nosip Show instances with SIP disabled |
226 |
--nosip Show instances with SIP disabled |
| 191 |
--plack Show instances with Plack enabled |
227 |
--plack Show instances with Plack enabled |
| 192 |
--noplack Show instances with Plack disabled |
228 |
--noplack Show instances with Plack disabled |
|
|
229 |
--letsencrypt Show instances with letsencrypt enabled |
| 230 |
--noletsencrypt Show instances with letsencrypt disabled |
| 193 |
--help | -h Show this help |
231 |
--help | -h Show this help |
| 194 |
|
232 |
|
| 195 |
The filtering options can be combined, and you probably want to do this |
233 |
The filtering options can be combined, and you probably want to do this |
|
Lines 201-223
show="all"
Link Here
|
| 201 |
show_email="all" |
239 |
show_email="all" |
| 202 |
show_sip="all" |
240 |
show_sip="all" |
| 203 |
show_plack="all" |
241 |
show_plack="all" |
|
|
242 |
show_letsencrypt="all" |
| 204 |
|
243 |
|
| 205 |
args=$(getopt -l help,enabled,disabled,email,noemail,sip,nosip,plack,noplack -o h -n $0 -- "$@") |
244 |
args=$(getopt -l help,enabled,disabled,email,noemail,sip,nosip,plack,noplack,letsencrypt,noletsencrypt -o h -n $0 -- "$@") |
| 206 |
set -- $args |
245 |
set -- $args |
| 207 |
|
246 |
|
| 208 |
while [ ! -z "$1" ] |
247 |
while [ ! -z "$1" ] |
| 209 |
do |
248 |
do |
| 210 |
case "$1" in |
249 |
case "$1" in |
| 211 |
-h|--help) usage; exit;; |
250 |
-h|--help) usage; exit;; |
| 212 |
--email) set_show_email "enabled" ;; |
251 |
--email) set_show_email "enabled" ;; |
| 213 |
--noemail) set_show_email "disabled" ;; |
252 |
--noemail) set_show_email "disabled" ;; |
| 214 |
--sip) set_show_sip "enabled" ;; |
253 |
--sip) set_show_sip "enabled" ;; |
| 215 |
--nosip) set_show_sip "disabled" ;; |
254 |
--nosip) set_show_sip "disabled" ;; |
| 216 |
--plack) set_show_plack "enabled" ;; |
255 |
--plack) set_show_plack "enabled" ;; |
| 217 |
--noplack) set_show_plack "disabled" ;; |
256 |
--noplack) set_show_plack "disabled" ;; |
| 218 |
--enabled) set_show "enabled" ;; |
257 |
--letsencrypt) set_show_letsencrypt "enabled" ;; |
| 219 |
--disabled) set_show "disabled" ;; |
258 |
--noletsencrypt) set_show_letsencrypt "disabled" ;; |
| 220 |
*) break;; |
259 |
--enabled) set_show "enabled" ;; |
|
|
260 |
--disabled) set_show "disabled" ;; |
| 261 |
*) break;; |
| 221 |
esac |
262 |
esac |
| 222 |
shift |
263 |
shift |
| 223 |
done |
264 |
done |
| 224 |
- |
|
|