mirror of
https://github.com/hassio-addons/bashio.git
synced 2025-05-06 20:11:24 +00:00
Avoid caching when API call fails (#164)
This commit is contained in:
parent
d70505aada
commit
445707a903
15 changed files with 104 additions and 0 deletions
|
@ -164,6 +164,10 @@ function bashio::addons() {
|
|||
info=$(bashio::cache.get 'addons.list')
|
||||
else
|
||||
info=$(bashio::api.supervisor GET "/addons" false)
|
||||
if [ "$?" -ne "${__BASHIO_EXIT_OK}" ]; then
|
||||
bashio::log.error "Failed to get addons from Supervisor API"
|
||||
return "${__BASHIO_EXIT_NOK}"
|
||||
fi
|
||||
bashio::cache.set "addons.list" "${info}"
|
||||
fi
|
||||
else
|
||||
|
@ -171,6 +175,10 @@ function bashio::addons() {
|
|||
info=$(bashio::cache.get "addons.${slug}.info")
|
||||
else
|
||||
info=$(bashio::api.supervisor GET "/addons/${slug}/info" false)
|
||||
if [ "$?" -ne "${__BASHIO_EXIT_OK}" ]; then
|
||||
bashio::log.error "Failed to get addon info from Supervisor API"
|
||||
return "${__BASHIO_EXIT_NOK}"
|
||||
fi
|
||||
bashio::cache.set "addons.${slug}.info" "${info}"
|
||||
fi
|
||||
fi
|
||||
|
@ -1202,6 +1210,10 @@ function bashio::addon.stats() {
|
|||
info=$(bashio::cache.get "addons.${slug}.stats")
|
||||
else
|
||||
info=$(bashio::api.supervisor GET "/addons/${slug}/stats" false)
|
||||
if [ "$?" -ne "${__BASHIO_EXIT_OK}" ]; then
|
||||
bashio::log.error "Failed to get addon stats from Supervisor API"
|
||||
return "${__BASHIO_EXIT_NOK}"
|
||||
fi
|
||||
bashio::cache.set "addons.${slug}.stats" "${info}"
|
||||
fi
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue