From 68590be2f202f77e488625fa332772043e1cedfc Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 20 May 2015 19:22:49 +0200 Subject: lib cac: wrap cac_via'ble calls with _cac_exec --- lib/cac.sh | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/lib/cac.sh b/lib/cac.sh index 47b73240a..48a711cd0 100644 --- a/lib/cac.sh +++ b/lib/cac.sh @@ -1,31 +1,25 @@ -cac_listservers() { +_cac_exec() { if test -z "${cac_via-}"; then - curl -fsS \ - -G \ - --data-urlencode key="$cac_key" \ - --data-urlencode login="$cac_login" \ - 'https://panel.cloudatcost.com/api/v1/listservers.php' + (exec "$@") else - ssh -q $cac_via -t curl -fsS \ + ssh -q "$cac_via" -t "$@" + 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' - fi } cac_listtasks() { - if test -z "${cac_via-}"; then + _cac_exec \ curl -fsS \ -G \ --data-urlencode key="$cac_key" \ --data-urlencode login="$cac_login" \ '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 } -- cgit v1.2.3