mirror of
https://github.com/hassio-addons/bashio.git
synced 2025-05-06 12:01:25 +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
|
@ -41,6 +41,10 @@ function bashio::network() {
|
|||
info=$(bashio::cache.get 'network.info')
|
||||
else
|
||||
info=$(bashio::api.supervisor GET /network/info false)
|
||||
if [ "$?" -ne "${__BASHIO_EXIT_OK}" ]; then
|
||||
bashio::log.error "Failed to get network info from Supervisor API"
|
||||
return "${__BASHIO_EXIT_NOK}"
|
||||
fi
|
||||
bashio::cache.set 'network.info' "${info}"
|
||||
fi
|
||||
|
||||
|
@ -105,6 +109,10 @@ function bashio::network.interface() {
|
|||
info=$(bashio::cache.get "network.interface.${interface}.info")
|
||||
else
|
||||
info=$(bashio::api.supervisor GET "/network/interface/${interface}/info" false)
|
||||
if [ "$?" -ne "${__BASHIO_EXIT_OK}" ]; then
|
||||
bashio::log.error "Failed to get network interface info from Supervisor API"
|
||||
return "${__BASHIO_EXIT_NOK}"
|
||||
fi
|
||||
bashio::cache.set "network.interface.${interface}.info" "${info}"
|
||||
fi
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue