mirror of
https://gitlab.alpinelinux.org/alpine/cloud/tiny-cloud.git
synced 2026-06-21 00:07:16 +03:00
fix error when non-root user tries to cache latest endpoint, also don't need to re-cache same endpoint
This commit is contained in:
parent
6290b1e1bd
commit
fbb910acc1
@ -1,6 +1,6 @@
|
||||
# CHANGELOG
|
||||
|
||||
## 2026-06-XX - Tiny Cloud v3.3.3
|
||||
## 2026-06-15 - Tiny Cloud v3.3.3
|
||||
|
||||
* Support IPv6 and multiple endpoints
|
||||
[#68](https://gitlab.alpinelinux.org/alpine/cloud/tiny-cloud/-/work_items/68)
|
||||
@ -9,6 +9,10 @@
|
||||
routable. Fixes race condition between `dhcpcd` starting and attempting to
|
||||
reach IMDS before routes are resolved.
|
||||
|
||||
* Currently the most recent IMDS endpoint that worked is cached, but only if
|
||||
**root** is running `imds`. We may consider keeping track of this per user
|
||||
in the future
|
||||
|
||||
## 2026-06-08 - Tiny Cloud v3.3.2
|
||||
|
||||
* Fixes an autodetect regression introduced in v3.3.1
|
||||
|
||||
5
bin/imds
5
bin/imds
@ -120,7 +120,7 @@ _imds_has_route() {
|
||||
}
|
||||
|
||||
_imds() {
|
||||
local endpoint endpoints routed attempts=1
|
||||
local endpoint endpoints routed attempts=1 cached
|
||||
if [ "$IMDS_ENDPOINT_WAIT_ATTEMPTS" -le 0 ]; then
|
||||
endpoints="$(_imds_endpoints)"
|
||||
fi
|
||||
@ -148,7 +148,8 @@ _imds() {
|
||||
wget --quiet --timeout 1 --output-document - \
|
||||
--header "$(_imds_header)" \
|
||||
"http://$endpoint/$IMDS_URI/$1$IMDS_QUERY" && {
|
||||
echo "$endpoint" > "$IMDS_ENDPOINT_CACHE"
|
||||
cached="$(cat "$IMDS_ENDPOINT_CACHE" 2>/dev/null)" || :
|
||||
[ "$endpoint" = "$cached" ] || echo "$endpoint" 2>/dev/null > "$IMDS_ENDPOINT_CACHE" || :
|
||||
return 0
|
||||
}
|
||||
done
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user