diff options
author | tv <tv@shackspace.de> | 2015-09-26 19:24:51 +0200 |
---|---|---|
committer | tv <tv@shackspace.de> | 2015-09-26 19:24:51 +0200 |
commit | 14de1d3c78385e3f8b6d694f5d799eb1b613159e (patch) | |
tree | 0ebb295d8131144760440bed16b1785d66b9fd04 | |
parent | 2c420a1b62ed2932b0a21999eb04472bb9dfa90b (diff) |
cac tasks: init
-rwxr-xr-x | cac | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -63,6 +63,7 @@ printf %s $binaryPrefix | tr -d 0 | wc -c cac_resources_cache=${cac_resources_cache-$HOME/tmp/cac_resources_cache.json} cac_servers_cache=${cac_servers_cache-$HOME/tmp/cac_servers_cache.json} +cac_tasks_cache=${cac_tasks_cache-$HOME/tmp/cac_tasks_cache.json} cac_templates_cache=${cac_templates_cache-$HOME/tmp/cac_templates_cache.json} cac_secrets=${cac_secrets-$HOME/.secrets/cac} @@ -128,6 +129,13 @@ __cac_cli__servers() { jq -r . $cac_servers_cache } +#? cac tasks +#? Print cached tasks JSON. +#? +__cac_cli__tasks() { + jq -r . $cac_tasks_cache +} + #? cac templates #? Print cached templates JSON. #? @@ -150,6 +158,7 @@ __cac_cli__update() {( for x in \ resources \ servers \ + tasks \ templates \ # This line intentionally left blank. do @@ -379,6 +388,18 @@ _cac_fetch_servers() {( fi )} +_cac_fetch_tasks() {( + res=$(_cac_get_api_v1 listtasks) + status=$(echo $res | jq -r .status) + + if [ "$status" = ok ]; then + echo "$res" | jq -r .data + else + echo "cac_fetch_tasks: bad status: $status" >&2 + exit 1 + fi +)} + _cac_fetch_templates() {( res=$(_cac_get_api_v1 listtemplates) status=$(echo $res | jq -r .status) |