diff options
author | tv <tv@krebsco.de> | 2015-05-20 19:22:49 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2015-05-20 19:22:49 +0200 |
commit | 55a3c5e2116ce3905d014075b01c827eae6e41ee (patch) | |
tree | 24c9fbfc24e06d37242314359e2841c516401218 /lib | |
parent | c8b1e69b21e321d54823379e622b53aae992f471 (diff) |
lib cac: wrap cac_via'ble calls with _cac_exec
Diffstat (limited to 'lib')
-rw-r--r-- | lib/cac.sh | 26 |
1 files changed, 10 insertions, 16 deletions
@@ -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 } |