lib cac: wrap cac_via'ble calls with _cac_exec

This commit is contained in:
tv 2015-05-20 19:22:49 +02:00
parent d7319a7e87
commit 68590be2f2

View file

@ -1,31 +1,25 @@
cac_listservers() { _cac_exec() {
if test -z "${cac_via-}"; then if test -z "${cac_via-}"; then
curl -fsS \ (exec "$@")
-G \
--data-urlencode key="$cac_key" \
--data-urlencode login="$cac_login" \
'https://panel.cloudatcost.com/api/v1/listservers.php'
else else
ssh -q $cac_via -t curl -fsS \ ssh -q "$cac_via" -t "$@"
-G \
--data-urlencode key="$cac_key" \
--data-urlencode login="$cac_login" \
'https://panel.cloudatcost.com/api/v1/listservers.php'
fi fi
} }
cac_listservers() {
_cac_exec \
curl -fsS \
-G \
--data-urlencode key="$cac_key" \
--data-urlencode login="$cac_login" \
'https://panel.cloudatcost.com/api/v1/listservers.php'
}
cac_listtasks() { cac_listtasks() {
if test -z "${cac_via-}"; then _cac_exec \
curl -fsS \ curl -fsS \
-G \ -G \
--data-urlencode key="$cac_key" \ --data-urlencode key="$cac_key" \
--data-urlencode login="$cac_login" \ --data-urlencode login="$cac_login" \
'https://panel.cloudatcost.com/api/v1/listtasks.php' 'https://panel.cloudatcost.com/api/v1/listtasks.php'
else
ssh -q $cac_via -t curl -fsS \
-G \
--data-urlencode key="$cac_key" \
--data-urlencode login="$cac_login" \
'https://panel.cloudatcost.com/api/v1/listtasks.php'
fi
} }