Skip to content

Commit 2019d1b

Browse files
committed
rename to api.core, fix errexit bug
1 parent d0dac93 commit 2019d1b

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

  • tailscale/rootfs

tailscale/rootfs/etc/s6-overlay/s6-rc.d/post-tailscaled/run

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export LOG_FD
66
# Runs after the machine has been logged in into the Tailscale network
77
# ==============================================================================
88

9-
source /usr/lib/core.sh
9+
source /usr/lib/api.core.sh
1010

1111
declare interface
1212
declare -a options
@@ -174,7 +174,7 @@ if keyexpiry=$(/opt/tailscale status --self=true --peers=false --json | jq -rce
174174
"Consider disabling key expiry to avoid losing connection to your Home Assistant device." \
175175
"You can use the [Machines page](https://login.tailscale.com/admin/machines) of Tailscale's admin console to disable key expiry." \
176176
"Please check your configuration based on the app's documentation under the \"Configuration\" section.")")
177-
if core.api POST services/persistent_notification/create "${attributes}" -w > /dev/null; then
177+
if api.core POST services/persistent_notification/create "${attributes}" -w > /dev/null; then
178178
touch "/data/key_expiry_notification_is_done"
179179
fi
180180
fi
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function log.error_or_warning() {
2323
# -s "Silent" Supress error message in case of a 404 Not found HTTP status code
2424
# -w "Warning only" Log only warnings instead of errors
2525
# ------------------------------------------------------------------------------
26-
function core.api() {
26+
function api.core() {
2727
local method="${1}"; shift
2828
local resource="/core/api/${1}"; shift
2929
local data='{}'
@@ -116,7 +116,8 @@ function core.api() {
116116

117117
if bashio::var.has_value "${filter}"; then
118118
bashio::log.debug "Filtering response using: ${filter}"
119-
response=$(bashio::jq "${response}" "${filter}")
119+
response=$(bashio::jq "${response}" "${filter}") \
120+
|| return "${__BASHIO_EXIT_NOK}"
120121
fi
121122

122123
echo "${response}"

0 commit comments

Comments
 (0)